# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
771765 | 2023-07-03T09:05:23 Z | khshg | 식물 비교 (IOI20_plants) | C++14 | 1 ms | 256 KB |
#include"plants.h" #include<bits/stdc++.h> using namespace std; vector<int> know, r; int N; int goR = 0; void init(int k, vector<int> _r) { swap(r, _r); N = (int)r.size(); for(int i = 0; i + 1 < N; ++i) { if(r[i] != r[i + 1] && r[i + 1]) { goR = N - 1 - i; break; } } rotate(r.begin(), r.begin()+r.size()-goR, r.end()); int cnt = 0; for(int i = 1; i < N; ++i) { cnt += (r[i - 1] != r[i] && r[i - 1]); } if(cnt == 1) { for(int i = 0; r[i]; ++i) { know.push_back(i); } for(int i = N - 1; know.size() + 1 < N; --i) { know.push_back(i); } } return; } int compare_plants(int x, int y) { x += goR; y += goR; x %= N; y %= N; if((int)know.size()) { return know[x] < know[y] ? -1 : 1; } if(x == 0 && y == N - 1) return r[y] ? 1 : -1; if(y - x > 1) { return 0; } return r[x] ? -1 : 1; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Incorrect | 0 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 | 1 ms | 256 KB | Output is correct |
3 | Incorrect | 0 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 | 1 ms | 256 KB | Output is correct |
3 | Incorrect | 0 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 | Incorrect | 0 ms | 212 KB | Output isn't correct |
3 | 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 | 0 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 | Correct | 1 ms | 212 KB | Output is correct |
3 | Incorrect | 0 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 | Correct | 0 ms | 212 KB | Output is correct |
3 | Incorrect | 0 ms | 212 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |