# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
400224 | 2021-05-07T17:30:54 Z | faresbasbs | Comparing Plants (IOI20_plants) | C++14 | 70 ms | 3048 KB |
#include <bits/stdc++.h> #include "plants.h" using namespace std; bool seen[5001]; int val[5001]; void init(int k , vector<int> r){ int n = r.size() , cnt = 0;; for(int i = 0 ; i < n ; i += 1){ int pos; for(int j = 0 ; j < n ; j += 1){ if(seen[j] || r[j]){ continue; } pos = j; } for(int j = 1 ; j < k ; j += 1){ if(seen[(pos-j+n)%n] || r[(pos-j+n)%n]){ continue; } pos = (pos-j+n)%n; break; } val[pos] = cnt++; seen[pos] = 1; for(int j = 1 ; j < k ; j += 1){ if(seen[(pos-j+n)%n]){ continue; } r[(pos-j+n)%n] -= 1; } } } int compare_plants(int x, int y){ if(!seen[x] || !seen[y]){ return 0; } if(val[x] < val[y]){ return 1; } return -1; }
Compilation message
# | 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 | 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 | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Incorrect | 1 ms | 204 KB | Output isn't correct |
6 | 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 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Incorrect | 1 ms | 204 KB | Output isn't correct |
6 | 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 | 70 ms | 3048 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 | 1 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 | 1 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 | Correct | 1 ms | 204 KB | Output is correct |
4 | Incorrect | 1 ms | 204 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |