# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
377391 | 2021-03-14T06:42:52 Z | Thistle | Comparing Plants (IOI20_plants) | C++14 | 108 ms | 8044 KB |
#include "plants.h" #include <vector> #include<algorithm> #include<set> #include<iostream> #include<random> #include<queue> #include<cassert> using namespace std; using ll=long long; using H=pair<ll, ll>; #define vec vector #define vi vec<ll> #define pb push_back #define all(a) (a).begin(),(a).end() #define rng(i,a,b) for(int (i)=(a);(i)<(b);(i)++) #define rep(i,n) rng((i),0,(n)) #define siz(a) int((a).size()) int n,all; vec<int>csum; void init(int k, std::vector<int> r) { //DAG kouchiku n=siz(r); csum.assign(n,0); rep(i,n) { csum[i]=r[i]; all+=r[i]; } rng(i,1,n) csum[i]+=csum[i-1]; return; } int sum(int l,int r){ return csum[r]-(l==0?0:csum[l-1]); } int compare_plants(int x, int y) { if(sum(x,y-1)==0||all-sum(x,y-1)==(n-(y-x))){ return 1; } if(sum(x,y-1)==y-x||sum(x,y-1)==all){ return -1; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 0 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 62 ms | 3180 KB | Output is correct |
7 | Correct | 71 ms | 3564 KB | Output is correct |
8 | Correct | 93 ms | 4972 KB | Output is correct |
9 | Correct | 108 ms | 7404 KB | Output is correct |
10 | Correct | 97 ms | 8044 KB | Output is correct |
11 | Correct | 93 ms | 7276 KB | Output is correct |
12 | Correct | 92 ms | 7916 KB | Output is correct |
13 | Correct | 89 ms | 6636 KB | Output is correct |
14 | Correct | 94 ms | 8044 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 376 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Incorrect | 1 ms | 364 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 376 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Incorrect | 1 ms | 364 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 364 KB | Output is correct |
2 | Incorrect | 1 ms | 364 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Incorrect | 1 ms | 364 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Incorrect | 42 ms | 364 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 0 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 62 ms | 3180 KB | Output is correct |
7 | Correct | 71 ms | 3564 KB | Output is correct |
8 | Correct | 93 ms | 4972 KB | Output is correct |
9 | Correct | 108 ms | 7404 KB | Output is correct |
10 | Correct | 97 ms | 8044 KB | Output is correct |
11 | Correct | 93 ms | 7276 KB | Output is correct |
12 | Correct | 92 ms | 7916 KB | Output is correct |
13 | Correct | 89 ms | 6636 KB | Output is correct |
14 | Correct | 94 ms | 8044 KB | Output is correct |
15 | Correct | 1 ms | 376 KB | Output is correct |
16 | Correct | 1 ms | 364 KB | Output is correct |
17 | Incorrect | 1 ms | 364 KB | Output isn't correct |
18 | Halted | 0 ms | 0 KB | - |