# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
759188 | Dan4Life | 게임 (IOI14_game) | C++17 | 1079 ms | 2892 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
int n, p[1501],sz[1501];
vector<int> v[1501];
bool chk[1501][1501];
int findSet(int i){return i==p[i]?i:p[i]=findSet(p[i]);}
int unionSet(int i, int j){
int x = findSet(i), y = findSet(j);
if(x==y) return 1;
if(sz[x]<sz[y]) swap(x,y);
for(auto u : v[y]) v[x].pb(u); v[y].clear();
p[y] = x; sz[x]+=sz[y]; return 1;
}
void initialize(int N){
n = N; for(int i =0; i < N; i++) p[i]=i,sz[i]=1,v[i].pb(i);
}
int hasEdge(int u, int vv){
int cnt = 0, x = findSet(u), y = findSet(vv);
chk[u][vv]=chk[vv][u]=1; if(x==y) return 0;
for(auto i : v[x]) for(auto j : v[y]) cnt+=chk[i][j];
return cnt==sz[x]*sz[y]?unionSet(u,vv):0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |