# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
434588 | 2021-06-21T12:28:24 Z | pere_gil | 식물 비교 (IOI20_plants) | C++17 | 120 ms | 6104 KB |
#include "plants.h" #include "bits/stdc++.h" using namespace std; vector<int> v; vector<int> acc; int tam; void init(int k, std::vector<int> r) { v=r; tam=k; acc.push_back(v[0]); for(int i=1;i<v.size();i++) acc.push_back(acc[i-1]+v[i]); return; } bool op1(int l, int r){ int aux; if(l<r){ aux=acc[r-1]; aux-=(l==0) ? 0 : acc[l-1]; return aux==(r-l); } aux=acc.back()-acc[l-1]; aux+=(r==0) ? 0 : acc[r-1]; return aux==(acc.size()-l+r); } bool op2(int l, int r){ int aux; if(l<r){ aux=acc[r-1]; aux-=(l==0) ? 0 : acc[l-1]; return !aux; } aux=acc.back()-acc[l-1]; aux+=(r==0) ? 0 : acc[r-1]; return !aux; } int compare_plants(int x, int y) { if(op1(x,y) || op2(y,x)) return -1; if(op1(y,x) || op2(x,y)) return 1; return 0; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 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 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 62 ms | 3028 KB | Output is correct |
7 | Correct | 70 ms | 3472 KB | Output is correct |
8 | Correct | 93 ms | 6072 KB | Output is correct |
9 | Correct | 93 ms | 6104 KB | Output is correct |
10 | Correct | 93 ms | 6080 KB | Output is correct |
11 | Correct | 120 ms | 6076 KB | Output is correct |
12 | Correct | 93 ms | 6068 KB | Output is correct |
13 | Correct | 89 ms | 6072 KB | Output is correct |
14 | Correct | 86 ms | 6076 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Incorrect | 1 ms | 204 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Incorrect | 1 ms | 204 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Incorrect | 1 ms | 204 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | 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 | Incorrect | 0 ms | 204 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 0 ms | 204 KB | Output is correct |
4 | Incorrect | 1 ms | 204 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 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 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 62 ms | 3028 KB | Output is correct |
7 | Correct | 70 ms | 3472 KB | Output is correct |
8 | Correct | 93 ms | 6072 KB | Output is correct |
9 | Correct | 93 ms | 6104 KB | Output is correct |
10 | Correct | 93 ms | 6080 KB | Output is correct |
11 | Correct | 120 ms | 6076 KB | Output is correct |
12 | Correct | 93 ms | 6068 KB | Output is correct |
13 | Correct | 89 ms | 6072 KB | Output is correct |
14 | Correct | 86 ms | 6076 KB | Output is correct |
15 | Correct | 1 ms | 204 KB | Output is correct |
16 | Correct | 0 ms | 204 KB | Output is correct |
17 | Incorrect | 1 ms | 204 KB | Output isn't correct |
18 | Halted | 0 ms | 0 KB | - |