# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
734762 | 2023-05-03T04:42:23 Z | keisuke6 | 철인 이종 경기 (APIO18_duathlon) | C++14 | 1000 ms | 7400 KB |
#include <bits/stdc++.h> using namespace std; #define int long long bool sub3(vector<vector<int>> &G){ for(int i=0;i<G.size();i++)if(G[i].size() > 2) return false; return true; } struct Unionfind{ vector<int> par, siz; //初期化 Unionfind(int n) : par(n,-1) , siz(n,1) {} int root(int x) { if(par[x] == -1) return x; else return par[x] = root(par[x]); } bool issame(int x,int y) { return root(x) == root(y); } bool unite(int x, int y){ x = root(x); y = root(y); if(x == y) return false; if(siz[x] < siz[y]) swap(x,y); par[y] = x; siz[x] += siz[y]; return true; } int size(int x) { return siz[root(x)]; } }; signed main(){ int N,M; cin>>N>>M; vector<vector<int>> G(N); for(int i=0;i<M;i++){ int a,b; cin>>a>>b; a--; b--; G[a].push_back(b); G[b].push_back(a); } int ans = 0; for(int i=0;i<N;i++){ vector<int> dist(N,1e18); dist[i] = 0; queue<int> q; q.push(i); while(!q.empty()){ int pos = q.front(); q.pop(); for(int x:G[pos]){ if(dist[x] != 1e18) continue; dist[x] = dist[pos] + 1; q.push(x); } } for(int j=0;j<N;j++)if(dist[j] >= 2) ans += dist[j]-1; } cout<<ans<<endl; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 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 | Execution timed out | 1069 ms | 6672 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 18 ms | 340 KB | Output is correct |
2 | Correct | 18 ms | 308 KB | Output is correct |
3 | Correct | 19 ms | 376 KB | Output is correct |
4 | Correct | 25 ms | 360 KB | Output is correct |
5 | Correct | 22 ms | 372 KB | Output is correct |
6 | Correct | 23 ms | 340 KB | Output is correct |
7 | Correct | 23 ms | 340 KB | Output is correct |
8 | Correct | 22 ms | 340 KB | Output is correct |
9 | Correct | 23 ms | 368 KB | Output is correct |
10 | Incorrect | 15 ms | 340 KB | Output isn't correct |
11 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1070 ms | 7400 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 19 ms | 384 KB | Output is correct |
2 | Correct | 21 ms | 376 KB | Output is correct |
3 | Incorrect | 22 ms | 340 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1086 ms | 7400 KB | Time limit exceeded |
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 | 1 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |