제출 #442911

#제출 시각아이디문제언어결과실행 시간메모리
442911algorithm16게임 (IOI14_game)C++14
0 / 100
1 ms332 KiB
#include "game.h" #include<iostream> #include<cstring> #include<algorithm> using namespace std; int cnt[1505],cnt2[1505],ind,ind1[1505],x[1505],bio[1505][1505],n1; void initialize(int n) { memset(ind1,-1,sizeof(ind1)); n1=n; } int hasEdge(int u, int v) { int a=u,b=v,c=0,ret; bio[a][b]=1; bio[b][a]=1; if(ind1[a]!=-1 && ind1[b]!=-1 && ind1[a]>ind1[b]) swap(a,b); if(ind1[b]!=-1 && ind1[a]==-1) swap(a,b); //if(a==1 && b==2) cout << cnt[a] << " " << cnt2[a] << " " << ind1[a] << " " << ind << "\n"; if(ind1[a]!=-1) { if(n1-1-cnt[a]>ind1[a]+1) ret=0; else ret=1; c=3; } if(ind1[a]==-1 && n1-1-cnt[a]==ind-cnt2[a]+1) { ret=1; ind1[a]=ind; for(int j=0;j<n1;j++) { if(bio[j][a]) cnt2[j]+=1; } ind+=1; c=1; } if(ind1[b]==-1 && n1-1-cnt[b]==ind-cnt2[b]+1) { ret=1; ind1[b]=ind; for(int j=0;j<n1;j++) { if(bio[j][b]) cnt2[j]+=1; } ind+=1; c=2; } if(!c) ret=0; cnt[a]+=1; cnt[b]+=1; return ret; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...