# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
829612 | 2023-08-18T13:21:36 Z | tolbi | Duathlon (APIO18_duathlon) | C++17 | 1000 ms | 1048576 KB |
#pragma optimize("Bismillahirrahmanirrahim") //█▀█─█──█──█▀█─█─█ //█▄█─█──█──█▄█─█■█ //█─█─█▄─█▄─█─█─█─█ //Allahuekber //ahmet23 orz... //FatihSultanMehmedHan //YavuzSultanSelimHan //AbdulhamidHan //Sani buyuk Osman Pasa Plevneden cikmam diyor #define author tolbi #include <bits/stdc++.h> using namespace std; #define deci(x) int x;cin>>x; #define decstr(x) string x;cin>>x; #define sortarr(x) sort(x.begin(), x.end()) #define sortrarr(x) sort(x.rbegin(), x.rend()) #define rev(x) reverse(x.begin(), x.end()) #define cinarr(x) for (auto &it : x) cin>>it; #define coutarr(x) for (auto &it : x) cout<<it<<" ";cout<<endl; #define tol(bi) (1LL<<((int)(bi))) #define endl '\n' #define int long long mt19937 ayahya(chrono::high_resolution_clock().now().time_since_epoch().count()); int32_t main(){ int T = 1; int tno = 0; while (T-(tno++)){ deci(n);deci(m); vector<vector<int>> arr(n); for (int i = 0; i < m; ++i) { deci(u);deci(v); arr[u-1].push_back(v-1); arr[v-1].push_back(u-1); } vector<int> subsz(n); auto f = [&](int node, int lnode, auto f)->void{ subsz[node]=1; for (int i = 0; i < arr[node].size(); i++){ if (arr[node][i]==lnode) continue; f(arr[node][i],node,f); subsz[node]+=subsz[arr[node][i]]; } }; f(0,-1,f); int ans = 0; int crr = 0; for (int node = 0; node < n; node++){ crr=n-subsz[node]; for (int i = 0; i < arr[node].size(); i++){ if (subsz[arr[node][i]]>subsz[node]) continue; ans+=crr*subsz[arr[node][i]]; crr+=subsz[arr[node][i]]; } } cout<<ans*2<<endl; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 530 ms | 1048576 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 530 ms | 1048576 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1102 ms | 823732 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 304 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 1 ms | 308 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Incorrect | 1 ms | 340 KB | Output isn't correct |
11 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 58 ms | 7116 KB | Output is correct |
2 | Correct | 73 ms | 8616 KB | Output is correct |
3 | Correct | 59 ms | 8364 KB | Output is correct |
4 | Correct | 75 ms | 8304 KB | Output is correct |
5 | Correct | 58 ms | 8340 KB | Output is correct |
6 | Correct | 60 ms | 10352 KB | Output is correct |
7 | Correct | 63 ms | 10100 KB | Output is correct |
8 | Correct | 83 ms | 9604 KB | Output is correct |
9 | Correct | 59 ms | 9092 KB | Output is correct |
10 | Incorrect | 58 ms | 8416 KB | Output isn't correct |
11 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 308 KB | Output is correct |
3 | Runtime error | 529 ms | 1048576 KB | Execution killed with signal 9 |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 68 ms | 7116 KB | Output is correct |
2 | Correct | 64 ms | 8232 KB | Output is correct |
3 | Runtime error | 730 ms | 1048576 KB | Execution killed with signal 9 |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 530 ms | 1048576 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 530 ms | 1048576 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |