# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
833776 | kevinsogo | 코끼리 (Dancing Elephants) (IOI11_elephants) | C++17 | 9082 ms | 3252 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#include "elephants.h"
using ll = long long;
#ifdef LOCAL
bool debug = true;
#else
bool debug = false;
#endif
int n, L;
vector<pair<int,int>> x;
vector<int> best;
void init(int N, int L, int X[]) {
n = N;
::L = L;
x.resize(n);
best.resize(n + 1);
for (int i = 0; i < n; i++) {
x[i] = {X[i], i};
}
}
int update(int i, int y) {
if (debug) { cerr << "DOING UPDATE " << i << " " << y << endl; }
if (debug) { cerr << "INITIALLY: "; }
if (debug) { for (int t = 0; t < n; t++) cerr << x[t].first << " "; cerr << endl; }
for (int t = 0; t < x.size(); t++) {
auto& [v, j] = x[t];
if (j == i) {
v = y;
i = t;
break;
}
}
assert(x[i].first == y);
while (i + 1 < n and x[i].first > x[i + 1].first) {
swap(x[i], x[i + 1]);
i++;
}
while (i - 1 >= 0 and x[i - 1].first > x[i].first) {
swap(x[i - 1], x[i]);
i--;
}
if (debug) { cerr << "AFTER UPDATE: "; }
if (debug) { for (int t = 0; t < n; t++) cerr << x[t].first << " "; cerr << endl; }
int prev = -1;
for (int i = 0; i < n; i++) {
while (prev + 1 < i and x[prev + 1].first <= x[i].first - L - 1) {
prev++;
}
best[i + 1] = best[prev + 1] + 1;
}
return best[n];
}
컴파일 시 표준 에러 (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... |