Submission #476608

#TimeUsernameProblemLanguageResultExecution timeMemory
476608malarHandcrafted Gift (IOI20_gift)C++14
Compilation error
0 ms0 KiB
import java.util.Arrays; public class gift { int construct(int n, int r, int[] a, int[] b, int[] x) { String s = ""; for(int i=0; i<r; i++) { if(a[i] == 0) { for(int j = a[i]; j <= b[i]; j++) { if(x[i] == 1) {//red if(s.length() !=0 && s.length()-1 >= j) { if(s.charAt(j) == 'B')// { return 0; } else if(s.charAt(j) == 'R'){ continue; } else { } } s= s + "R"; } else if(x[i] == 2) // blue { if(s.length() !=0 && s.length()-1 >= j) { if(s.charAt(j) == 'R') { return 0; } else if(s.charAt(j) == 'B'){ continue; } } s = s + "B"; } } } else { for(int j = a[i]+1; j <= b[i]; j++) { if(x[i] == 1) {//red if(s.length() !=0 && s.length()-1 >= j) { if(s.charAt(j) == 'B')// { return 0; } else if(s.charAt(j) == 'R'){ continue; } } s= s + "R"; } else if(x[i] == 2) // blue { if(s.length() !=0 && s.length()-1 >= j) { if(s.charAt(j) == 'R') { return 0; } else if(s.charAt(j) == 'B'){ continue; } } s = s + "B"; } } } } grader.craft(s); return 1; } }

Compilation message (stderr)

gift.cpp:1:1: error: 'import' does not name a type
    1 | import java.util.Arrays;
      | ^~~~~~
gift.cpp:2:1: error: expected unqualified-id before 'public'
    2 | public class gift {
      | ^~~~~~