Submission #1030886

#TimeUsernameProblemLanguageResultExecution timeMemory
1030886vjudge1Rooted MST (innopolis2021_final_E)C++17
0 / 100
291 ms12628 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define f first #define s second mt19937 gnd(time(NULL)); void solve(){ int n, m; cin >> n >> m; int ans = 0; vector<int> v(n-1); for(int i = 0; i < n-1; i++){ int a, b; cin >> a >> b; cin >> v[i]; ans+=v[i]; } int q; cin >> q; while(q--){ int r, p; cin >> r >> p; ans-=v[r-1]; v[r-1]=p; ans+=p; cout << ans << endl; } } signed main(){ int t = 1; // cin >> t; while(t--) solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...