# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
618868 | Zanite | Dynamic Diameter (CEOI19_diameter) | C++17 | 181 ms | 7936 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using Edge = pair<ll, pll>;
#define fi first
#define se second
const int maxN = 1e5 + 5;
ll n, q, w;
ll id[maxN], dist[maxN];
multiset<ll> dpq;
int main() {
scanf("%lld %lld %lld", &n, &q, &w);
dpq.insert(0);
for (ll a, b, c, i = 1; i < n; i++) {
scanf("%lld %lld %lld", &a, &b, &c);
if (b == 1) swap(a, b);
id[i-1] = b;
dist[b] = c;
dpq.insert(c);
}
ll last = 0;
for (ll d, e, i = 1; i <= q; i++) {
scanf("%lld %lld", &d, &e);
d = (d + last) % (n - 1);
e = (e + last) % w;
ll change = id[d];
dpq.erase(dpq.lower_bound(dist[change]));
dist[change] = e;
dpq.insert(e);
auto it = dpq.rbegin();
last = *it;
it++;
last += *it;
printf("%lld\n", last);
}
}
컴파일 시 표준 에러 (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... |