# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
618865 | 2022-08-02T08:02:46 Z | Zanite | Dynamic Diameter (CEOI19_diameter) | C++17 | 233 ms | 6944 KB |
#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.begin(); last = *it; it++; last += *it; printf("%lld\n", last); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 340 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 233 ms | 6944 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |