제출 #783882

#제출 시각아이디문제언어결과실행 시간메모리
783882FatihSolak게임 (IOI14_game)C++17
15 / 100
1 ms340 KiB
#include "game.h" #include <bits/stdc++.h> #define N 1500 using namespace std; int par[N]; int cnt[N][N]; int find(int a){ if(a == par[a])return a; return par[a] = find(par[a]); } int n; void initialize(int n){ ::n = n; for(int i = 0;i<n;i++){ par[i] = i; for(int j = 0;j<n;j++){ cnt[i][j] = i != j; } } } int hasEdge(int u, int v){ int tot = cnt[find(v)][find(u)]; cnt[find(u)][find(v)]--; cnt[find(v)][find(u)]--; if(tot > 1){ return 0; } for(int i = 0;i<n;i++){ cnt[find(u)][find(i)] += cnt[find(v)][find(i)]; cnt[find(i)][find(u)] += cnt[find(i)][find(v)]; } par[find(v)] = find(u); return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...