# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
431515 | 2021-06-17T12:35:42 Z | Hazem | Comparing Plants (IOI20_plants) | C++14 | 111 ms | 5736 KB |
#include "plants.h" #include <bits/stdc++.h> using namespace std; int k; vector<int>a,pr; void init(int K, std::vector<int> r) { k = k;a = pr = r; for(int i=1;i<a.size();i++) pr[i] += pr[i-1]; return; } bool check(int x,int y){ if(y>x) return (pr[y-1]-(x?pr[x-1]:0))==(y-x); else return (pr.back()-pr[x-1]+(y?pr[y-1]:0))==(pr.size()-x+y); } bool check1(int x,int y){ if(y>x) return (pr[y-1]-(x?pr[x-1]:0))==0; else return (pr.back()-pr[x-1]+(y?pr[y-1]:0))==0; } int compare_plants(int x, int y) { if(check(x,y)||check1(y,x)) return -1; if(check(y,x)||check1(x,y)) return 1; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 0 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 204 KB | Output is correct |
5 | Correct | 0 ms | 204 KB | Output is correct |
6 | Correct | 80 ms | 3012 KB | Output is correct |
7 | Correct | 69 ms | 3328 KB | Output is correct |
8 | Correct | 99 ms | 5704 KB | Output is correct |
9 | Correct | 103 ms | 5704 KB | Output is correct |
10 | Correct | 92 ms | 5700 KB | Output is correct |
11 | Correct | 101 ms | 5728 KB | Output is correct |
12 | Correct | 90 ms | 5660 KB | Output is correct |
13 | Correct | 111 ms | 5728 KB | Output is correct |
14 | Correct | 101 ms | 5736 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Incorrect | 0 ms | 204 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Incorrect | 0 ms | 204 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Incorrect | 1 ms | 204 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 240 KB | Output is correct |
4 | Incorrect | 0 ms | 204 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Incorrect | 1 ms | 204 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 0 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 204 KB | Output is correct |
5 | Correct | 0 ms | 204 KB | Output is correct |
6 | Correct | 80 ms | 3012 KB | Output is correct |
7 | Correct | 69 ms | 3328 KB | Output is correct |
8 | Correct | 99 ms | 5704 KB | Output is correct |
9 | Correct | 103 ms | 5704 KB | Output is correct |
10 | Correct | 92 ms | 5700 KB | Output is correct |
11 | Correct | 101 ms | 5728 KB | Output is correct |
12 | Correct | 90 ms | 5660 KB | Output is correct |
13 | Correct | 111 ms | 5728 KB | Output is correct |
14 | Correct | 101 ms | 5736 KB | Output is correct |
15 | Correct | 1 ms | 204 KB | Output is correct |
16 | Correct | 1 ms | 204 KB | Output is correct |
17 | Incorrect | 0 ms | 204 KB | Output isn't correct |
18 | Halted | 0 ms | 0 KB | - |