Submission #980784

# Submission time Handle Problem Language Result Execution time Memory
980784 2024-05-12T11:46:36 Z Unforgettablepl Duathlon (APIO18_duathlon) C++17
10 / 100
1000 ms 1048576 KB
#include <bits/stdc++.h>
using namespace std;

#define int long long

vector<int> adj[200001];
int ans;

void dfs(int x,int p,int depth){
    ans+=depth;
    for(int&i:adj[x])if(i!=p)dfs(i,x,depth+1);
}

int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n,m;
    cin >> n >> m;
    for(int i=1;i<=m;i++){
        int a,b;cin>>a>>b;
        adj[a].emplace_back(b);
        adj[b].emplace_back(a);
    }
    for(int i=1;i<=n;i++)dfs(i,0,-1);
    cout << ans+n << '\n';
}
# Verdict Execution time Memory Grader output
1 Execution timed out 1106 ms 940832 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1106 ms 940832 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1074 ms 736296 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 8 ms 4956 KB Output is correct
2 Correct 9 ms 5208 KB Output is correct
3 Correct 7 ms 5208 KB Output is correct
4 Correct 12 ms 5212 KB Output is correct
5 Correct 12 ms 5212 KB Output is correct
6 Correct 12 ms 5212 KB Output is correct
7 Correct 12 ms 5212 KB Output is correct
8 Correct 12 ms 5212 KB Output is correct
9 Correct 13 ms 5212 KB Output is correct
10 Correct 6 ms 5200 KB Output is correct
11 Correct 6 ms 4952 KB Output is correct
12 Correct 4 ms 4956 KB Output is correct
13 Correct 3 ms 4956 KB Output is correct
14 Correct 2 ms 4952 KB Output is correct
15 Correct 2 ms 4956 KB Output is correct
16 Correct 2 ms 4956 KB Output is correct
17 Correct 5 ms 4956 KB Output is correct
18 Correct 5 ms 5212 KB Output is correct
19 Correct 5 ms 5212 KB Output is correct
20 Correct 6 ms 5208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1044 ms 10064 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 8 ms 5164 KB Output is correct
2 Correct 8 ms 4956 KB Output is correct
3 Runtime error 796 ms 1048576 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1012 ms 10068 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1106 ms 940832 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1106 ms 940832 KB Time limit exceeded
2 Halted 0 ms 0 KB -