# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
769042 | t6twotwo | 식물 비교 (IOI20_plants) | C++17 | 4043 ms | 6996 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |