# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1049982 | 2024-08-09T06:38:55 Z | aykhn | 식물 비교 (IOI20_plants) | C++17 | 22 ms | 5468 KB |
#include "plants.h" #include <bits/stdc++.h> using namespace std; const int MXN = 5e3 + 5; int n; int a[MXN], cnt[MXN], f[MXN]; void init(int k, vector<int> r) { n = r.size(); for (int i = 0; i < n; i++) cnt[i] = k - 1; for (int i = 0; i < n; i++) { vector<int> idx; for (int i = 0; i < r.size(); i++) { if (f[i]) continue; if (r[i] == cnt[i]) idx.push_back(i); } assert(!idx.empty()); int ind = -1; if (idx.size() == 1) ind = idx[0]; else { for (int i = 0; i < idx.size(); i++) { if ((idx[(i + 1) % (int)idx.size()] - idx[i] + n) % n >= k) { ind = idx[(i + 1) % (int)idx.size()]; break; } } } assert(ind != -1); a[ind] = i; f[ind] = 1; for (int j = ind - 1; j != (ind - k + n) % n; j = (j - 1 + n) % n) cnt[j]--; } } int compare_plants(int x, int y) { return (a[x] > a[y] ? 1 : -1); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Runtime error | 0 ms | 604 KB | Execution killed with signal 6 |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Runtime error | 4 ms | 604 KB | Execution killed with signal 6 |
7 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Runtime error | 4 ms | 604 KB | Execution killed with signal 6 |
7 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Runtime error | 22 ms | 5468 KB | Execution killed with signal 6 |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Runtime error | 0 ms | 604 KB | Execution killed with signal 6 |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Runtime error | 1 ms | 604 KB | Execution killed with signal 6 |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Runtime error | 0 ms | 604 KB | Execution killed with signal 6 |
5 | Halted | 0 ms | 0 KB | - |