# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
835578 | 2023-08-23T16:16:58 Z | rubdary | 식물 비교 (IOI20_plants) | C++14 | 56 ms | 5356 KB |
#include "plants.h" #include <iostream> using namespace std; int N; vector <int> sum; void init(int k, vector<int> r){ sum.push_back(0); for(int i = 0; i < r.size(); i++){ sum.push_back(sum.back()+r[i]); } return; } int lower(int x, int y){ int suma = sum[y] - sum[x]; int cant = y - x; if(suma == 0) return 1; if(suma == cant) return -1; suma = (sum.back() - sum[y]) + (sum[x]); cant = N - cant; if(suma == 0) return -1; if(suma == cant) return 1; return 0; } int higher(int x, int y){ int suma = sum[x] - sum[y]; int cant = x - y; if(suma == 0) return -1; if(suma == cant) return 1; suma = (sum.back() - sum[x]) + (sum[y]); cant = N - cant; if(suma == 0) return 1; if(suma == cant) return -1; return 0; } int compare_plants(int x, int y){ N = sum.size()-1; if(x < y) return lower(x, y); return higher(x, y); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 38 ms | 3028 KB | Output is correct |
7 | Correct | 42 ms | 3328 KB | Output is correct |
8 | Correct | 54 ms | 5344 KB | Output is correct |
9 | Correct | 56 ms | 5316 KB | Output is correct |
10 | Correct | 56 ms | 5344 KB | Output is correct |
11 | Correct | 56 ms | 5316 KB | Output is correct |
12 | Correct | 53 ms | 5316 KB | Output is correct |
13 | Correct | 53 ms | 5356 KB | Output is correct |
14 | Correct | 53 ms | 5324 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Incorrect | 1 ms | 212 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Incorrect | 1 ms | 212 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | 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 | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Incorrect | 0 ms | 212 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Incorrect | 0 ms | 212 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 38 ms | 3028 KB | Output is correct |
7 | Correct | 42 ms | 3328 KB | Output is correct |
8 | Correct | 54 ms | 5344 KB | Output is correct |
9 | Correct | 56 ms | 5316 KB | Output is correct |
10 | Correct | 56 ms | 5344 KB | Output is correct |
11 | Correct | 56 ms | 5316 KB | Output is correct |
12 | Correct | 53 ms | 5316 KB | Output is correct |
13 | Correct | 53 ms | 5356 KB | Output is correct |
14 | Correct | 53 ms | 5324 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Incorrect | 1 ms | 212 KB | Output isn't correct |
18 | Halted | 0 ms | 0 KB | - |