Implementation
Time Complexity:
Java
import java.io.*;import java.util.*;public class ModernArt2 {public static void main(String[] args) throws IOException {BufferedReader in = new BufferedReader(new FileReader("art2.in"));PrintWriter out = new PrintWriter(new FileWriter("art2.out"));int N = Integer.parseInt(in.readLine());int[] start = new int[N + 1];int[] end = new int[N + 1];
C++
#include <bits/stdc++.h>using namespace std;int main() {freopen("art2.in", "r", stdin);freopen("art2.out", "w", stdout);int n;cin >> n;vector<int> col(n + 1);vector<int> start(n + 1, INT32_MAX);
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!