제출 #30473

#제출 시각아이디문제언어결과실행 시간메모리
30473inqr게임 (IOI14_game)C++14
0 / 100
0 ms19672 KiB
#include "game.h" #include <bits/stdc++.h> #define pb push_back #define mp make_pair #define rt insert #define st first #define nd second #define ll long long #define pii pair < int , int > #define DB printf("debug\n"); #define umax( x , y ) x = max( x , (y) ) #define umin( x , y ) x = min( x , (y) ) #define all(x) x.begin() , x.end() using namespace std; int conto[1505]; int uknwed[1505][1505]; int par[1505],size[1505]; int N,totno,maxque,maxyes,maxno; int parfind(int a){ if(par[a]==a)return a; return par[a]=parfind(par[a]); } void merge(int a,int b){ int para=parfind(a),parb=parfind(b); par[parb]=para; size[para]+=size[parb]; for(int i=0;i<N;i++){ uknwed[parfind(i)][para]=uknwed[para][parfind(i)]=uknwed[para][parfind(i)]+uknwed[parb][parfind(i)]; } } void build(int a){ par[a]=a;size[a]=1; } void initialize(int n) { N=n; for(int i=0;i<n;i++){ build(i); } for(int i=0;i<n;i++) for(int j=0;j<n;j++) if(i!=j)uknwed[i][j]=1; } int hasEdge2(int u,int v){ int ur=parfind(u),uv=parfind(v); if(uknwed[ur][uv]==1){ merge(u,v); } uknwed[ur][uv]--; return 0; } int hasEdge(int u, int v) { return hasEdge2(u,v); conto[max(u,v)]++; if(conto[max(u,v)]==max(u,v))return 1; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...