# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
769042 | 2023-06-29T05:33:31 Z | t6twotwo | 식물 비교 (IOI20_plants) | C++17 | 4000 ms | 6996 KB |
#include "plants.h" #include <bits/stdc++.h> using namespace std; using ll = long long; int N, K; vector<int> R, A, pfs; void init(int k, std::vector<int> r) { K = k, R = r; N = R.size(); A.resize(N, -1); if (K == 2) { pfs.resize(N + 1); for (int i = 0; i < N; i++) { pfs[i + 1] = pfs[i] + R[i]; } return; } for (int i = 0; i < N; i++) { vector<int> v; for (int j = 0; j < N; j++) { if (A[j] == -1 && R[j] == K - 1) { v.push_back(j); } } int m = v.size(), p; if (m == 1 || N - v[m - 1] + v[0] >= K) { p = v[0]; } else { for (int j = 0; j + 1 < m; j++) { if (v[j + 1] - v[j] >= K) { p = v[j + 1]; } } } A[p] = i; for (int j = 1; j < K; j++) { R[(p - j + N) % N]++; } } } int compare_plants(int x, int y) { if (K == 2) { if (pfs[y] - pfs[x] == 0) { return 1; } if (pfs[y] - pfs[x] == y - x) { return -1; } if (pfs[N] - pfs[y] + pfs[x] == 0) { return -1; } if (pfs[N] - pfs[y] + pfs[x] == N - y + x) { return 1; } } return A[x] > A[y] ? 1 : -1; }
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 | 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 | 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 | 1 ms | 212 KB | Output is correct |
6 | Correct | 8 ms | 364 KB | Output is correct |
7 | Correct | 202 ms | 3104 KB | Output is correct |
8 | Correct | 2 ms | 340 KB | Output is correct |
9 | Correct | 8 ms | 340 KB | Output is correct |
10 | Correct | 211 ms | 3112 KB | Output is correct |
11 | Correct | 159 ms | 3104 KB | Output is correct |
12 | Correct | 179 ms | 3284 KB | Output is correct |
13 | Correct | 225 ms | 3112 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 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 | 1 ms | 212 KB | Output is correct |
6 | Correct | 8 ms | 364 KB | Output is correct |
7 | Correct | 202 ms | 3104 KB | Output is correct |
8 | Correct | 2 ms | 340 KB | Output is correct |
9 | Correct | 8 ms | 340 KB | Output is correct |
10 | Correct | 211 ms | 3112 KB | Output is correct |
11 | Correct | 159 ms | 3104 KB | Output is correct |
12 | Correct | 179 ms | 3284 KB | Output is correct |
13 | Correct | 225 ms | 3112 KB | Output is correct |
14 | Correct | 2529 ms | 3340 KB | Output is correct |
15 | Execution timed out | 4037 ms | 5732 KB | Time limit exceeded |
16 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 296 KB | Output is correct |
3 | Correct | 59 ms | 3316 KB | Output is correct |
4 | Execution timed out | 4043 ms | 6996 KB | Time limit exceeded |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 304 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 | 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 | Correct | 0 ms | 212 KB | Output is correct |
4 | Incorrect | 0 ms | 212 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |