# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
300265 | marX | 식물 비교 (IOI20_plants) | C++17 | 4061 ms | 6028 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <vector>
using namespace std;
vector<int> xrank;
void init(int k, vector<int> r)
{
int n = r.size();
xrank.resize(n);
vector<bool> used(n);
int remaining = n;
int pos = n;
for (int i = 0; i < n; ++i, --remaining)
{
vector<int> current;
for (int i = 0; i < n; ++i)
{
if (used[i])
continue;
if (r[i] == 0)
current.push_back(i);
}
int start = 0;
int max_diff = current[0] + n - current.back();
for (int i = 1; i < current.size(); ++i)
{
int cur_diff = current[i] - current[i - 1];
if (cur_diff > max_diff)
{
max_diff = cur_diff;
start = i;
}
}
if (current.empty())
break;
int u = current[start];
used[u] = true;
xrank[u] = pos--;
for (int j = 1; j < k; ++j)
{
int t = (u - j + n) % n;
r[t]--;
// debug(t, u, r[t]);
}
// debug(i);
// debug(current[start], current);
// debug(used);
// debug(r);
}
// debug(remaining);
// if (remaining != 0)
// fin("FAIL!!!");
}
int compare_plants(int a, int b)
{
return xrank[a] > xrank[b] ? +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... |