# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
553631 | 2022-04-26T12:34:05 Z | InternetPerson10 | Comparing Plants (IOI20_plants) | C++17 | 81 ms | 13368 KB |
#include "plants.h" #include <bits/stdc++.h> typedef long long ll; using namespace std; ll BIG = 1e7; vector<ll> ans; int k, n; void init(int g, std::vector<int> r) { k = g; k--; n = r.size(); ans.resize(n); if(k == 1) { ans.resize(3*n+1); ans[0] = 0; for(int i = 0; i < 3*n+1; i++) { if(r[i%n]) ans[i] = ans[i-1] - 1; else ans[i] = ans[i-1] + 1; } } return; } int compare_plants(int x, int y) { if(k == 1) { for(int i = x + n - 1; i <= 3*n; i += n) { for(int j = y + n - 1; j <= 3*n; j += n) { int a = min(i, j); int b = max(i, j); if(ans[b] - ans[a] == b - a) { if(a == i) return 1; return -1; } if(ans[a] - ans[b] == b - a) { if(a == i) return -1; return 1; } } } return 0; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 296 KB | Output is correct |
5 | Correct | 1 ms | 296 KB | Output is correct |
6 | Correct | 51 ms | 4016 KB | Output is correct |
7 | Correct | 63 ms | 5892 KB | Output is correct |
8 | Correct | 80 ms | 13268 KB | Output is correct |
9 | Correct | 79 ms | 13292 KB | Output is correct |
10 | Correct | 77 ms | 13280 KB | Output is correct |
11 | Correct | 76 ms | 13368 KB | Output is correct |
12 | Correct | 75 ms | 13272 KB | Output is correct |
13 | Correct | 72 ms | 13336 KB | Output is correct |
14 | Correct | 81 ms | 13288 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Incorrect | 1 ms | 212 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Incorrect | 1 ms | 212 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Incorrect | 0 ms | 212 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Incorrect | 1 ms | 212 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 304 KB | Output is correct |
4 | Incorrect | 1 ms | 212 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 296 KB | Output is correct |
5 | Correct | 1 ms | 296 KB | Output is correct |
6 | Correct | 51 ms | 4016 KB | Output is correct |
7 | Correct | 63 ms | 5892 KB | Output is correct |
8 | Correct | 80 ms | 13268 KB | Output is correct |
9 | Correct | 79 ms | 13292 KB | Output is correct |
10 | Correct | 77 ms | 13280 KB | Output is correct |
11 | Correct | 76 ms | 13368 KB | Output is correct |
12 | Correct | 75 ms | 13272 KB | Output is correct |
13 | Correct | 72 ms | 13336 KB | Output is correct |
14 | Correct | 81 ms | 13288 KB | Output is correct |
15 | Correct | 1 ms | 212 KB | Output is correct |
16 | Correct | 1 ms | 212 KB | Output is correct |
17 | Incorrect | 1 ms | 212 KB | Output isn't correct |
18 | Halted | 0 ms | 0 KB | - |