제출 #1060561

#제출 시각아이디문제언어결과실행 시간메모리
1060561vjudge1게임 (IOI14_game)C++17
15 / 100
6 ms17240 KiB
#include "game.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back const int INF=100000000; int father[2000]; int cnt[2000][2000]; int tamano[2000]; int N; void findF(int x, int y){ for(int i=0;i<N;i++){ if(father[i]==x){ father[i]=y; } } } void initialize(int n) { memset(cnt,0,sizeof(cnt)); for(int i=0;i<n;i++){ father[i]=i; tamano[i]=1; } N=n; } int hasEdge(int u, int v) { u=father[u]; v=father[v]; cnt[u][v]++; cnt[v][u]++; //cout<<father[u]<<" "<<father[v]<<" FATHER"<<endl; //cout<<tamano[u]<<" "<<tamano[v]<<" TAMANO"<<endl; //cout<<cnt[u][v]<<" CNT"<<endl; if(tamano[u]*tamano[v]==cnt[u][v] || tamano[u]*tamano[v]==cnt[v][u]){ if(tamano[v]>tamano[u]) swap(u,v); findF(v,u); tamano[u]+=tamano[v]; return 1; }else{ return 0; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...