# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
819393 | 2023-08-10T10:13:56 Z | Abrar_Al_Samit | 식물 비교 (IOI20_plants) | C++17 | 43 ms | 4808 KB |
#include <bits/stdc++.h> #include "plants.h" using namespace std; const int nax = 5002; int val[nax]; int sm[nax], n; void init(int k, vector<int> r) { n = r.size(); int tg = 1; queue<int>q; for(int i=0; i<n; ++i) { sm[i] = k - r[i] - 1; if(sm[i]==0) { q.push(i); } } while(!q.empty()) { vector<int>cur; while(!q.empty()) { cur.push_back(q.front()); q.pop(); } sort(cur.begin(), cur.end(), [&] (int x, int y) { if(x + k - 1 < n) { return y > x && y <= x + k - 1; } else { if(y < x) return (x + k - 1) % n >= y; else y > x; } }); for(int x : cur) { val[x] = ++tg; for(int z=x, cnt=0; cnt<=k; ++cnt, z=(z-1+n)%n) { if(--sm[z]==0) q.push(z); } } } } int compare_plants(int x, int y) { if(val[x]>val[y]) return 1; return -1; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | 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 | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 304 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Incorrect | 0 ms | 304 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 304 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Incorrect | 0 ms | 304 KB | Output isn't correct |
5 | 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 | 43 ms | 4808 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 | 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 | 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 | 1 ms | 212 KB | Output is correct |
3 | Incorrect | 1 ms | 212 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |