Submission #476598

#TimeUsernameProblemLanguageResultExecution timeMemory
476598malarHandcrafted Gift (IOI20_gift)Java
0 / 100
125 ms9472 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'){ s = s; } } 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'){ s = s; } } 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'){ s = s; } } 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'){ s = s; } } s = s + "B"; } } } } grader.craft(s); return 1; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...