# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1087746 | 2024-09-13T07:43:52 Z | alexander707070 | 철인 이종 경기 (APIO18_duathlon) | C++14 | 1000 ms | 1048576 KB |
#include<bits/stdc++.h> #define MAXN 1000007 using namespace std; int n,m,a,b; vector<int> v[MAXN]; long long sz[MAXN],sum[MAXN],ans; void dfs(int x,int p){ sz[x]=1; for(int i=0;i<v[x].size();i++){ if(v[x][i]==p)continue; dfs(v[x][i],x); sum[x]+=sz[v[x][i]]*(sz[v[x][i]]-1); sz[x]+=sz[v[x][i]]; } sum[x]+=(n-sz[x])*(n-sz[x]-1); } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin>>n>>m; for(int i=1;i<=m;i++){ cin>>a>>b; v[a].push_back(b); v[b].push_back(a); } dfs(1,0); for(int i=1;i<=n;i++){ ans+=(long long) (n-2)*(n-1)-sum[i]; } cout<<ans<<"\n"; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 551 ms | 1048576 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 551 ms | 1048576 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1080 ms | 1048576 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 23900 KB | Output is correct |
2 | Correct | 10 ms | 23816 KB | Output is correct |
3 | Correct | 11 ms | 23768 KB | Output is correct |
4 | Correct | 11 ms | 24056 KB | Output is correct |
5 | Correct | 10 ms | 23900 KB | Output is correct |
6 | Correct | 10 ms | 23880 KB | Output is correct |
7 | Correct | 10 ms | 23900 KB | Output is correct |
8 | Correct | 15 ms | 23952 KB | Output is correct |
9 | Correct | 10 ms | 23900 KB | Output is correct |
10 | Incorrect | 10 ms | 24000 KB | Output isn't correct |
11 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 35 ms | 28496 KB | Output is correct |
2 | Correct | 37 ms | 29776 KB | Output is correct |
3 | Correct | 37 ms | 29780 KB | Output is correct |
4 | Correct | 40 ms | 29776 KB | Output is correct |
5 | Correct | 43 ms | 29780 KB | Output is correct |
6 | Correct | 40 ms | 34144 KB | Output is correct |
7 | Correct | 43 ms | 32596 KB | Output is correct |
8 | Correct | 44 ms | 31916 KB | Output is correct |
9 | Correct | 40 ms | 31320 KB | Output is correct |
10 | Incorrect | 38 ms | 29780 KB | Output isn't correct |
11 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 23900 KB | Output is correct |
2 | Correct | 10 ms | 23988 KB | Output is correct |
3 | Runtime error | 633 ms | 1048576 KB | Execution killed with signal 9 |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 36 ms | 28508 KB | Output is correct |
2 | Correct | 37 ms | 29780 KB | Output is correct |
3 | Runtime error | 710 ms | 1048576 KB | Execution killed with signal 9 |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 551 ms | 1048576 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 551 ms | 1048576 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |