# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
834018 | finn__ | 식물 비교 (IOI20_plants) | C++17 | 4027 ms | 5036 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("avx,avx2,sse4")
#include <bits/stdc++.h>
#include "plants.h"
using namespace std;
constexpr size_t N = 200000;
size_t n;
int subtask, s[N], h[N];
void init(int k, std::vector<int> r)
{
n = r.size();
if (k == 2)
subtask = 1;
else
subtask = 2;
if (subtask == 1)
{
partial_sum(r.begin(), r.end(), s);
}
else
{
for (size_t i = 0; i < n - 1; ++i)
{
int conseq_nonzero = 0, next_max = 0;
for (size_t j = 0; j < 2 * n;)
{
while (j < 2 * n && !r[j % n])
++j;
size_t k = j;
while (k < 2 * n && r[k % n])
++k;
if (k - j > conseq_nonzero)
conseq_nonzero = k - j, next_max = k % n;
j = k;
}
h[next_max] = n - i;
r[next_max] = -1;
for (int j = next_max - k + 1; j < next_max; ++j)
r[(j + (int)n) % n]--;
}
}
}
int compare_plants(int x, int y)
{
if (subtask == 1)
{
int z = s[y - 1] - (x ? s[x - 1] : 0);
return !z ? 1 : (z == y - x ? -1 : (!(s[n - 1] - z) ? -1 : ((s[n - 1] - z == n - (y - x) ? 1 : 0))));
}
else
{
return h[x] > h[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... |