Editorial (icecuber)

Implementation

Time Complexity: O(NM)\mathcal{O}(NM)

import java.io.*;
import java.util.*;
public class ArrayDesc {
public static final int MOD = (int)1e9 + 7;
public static void main(String args[]) throws IOException {
BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(r.readLine());
int N = Integer.parseInt(st.nextToken());
int M = Integer.parseInt(st.nextToken());

Join the USACO Forum!

Stuck on a problem, or don't understand a module? Join the USACO Forum and get help from other competitive programmers!