Submission #1055527

#TimeUsernameProblemLanguageResultExecution timeMemory
1055527Hugo1729Parachute rings (IOI12_rings)C++11
0 / 100
124 ms17224 KiB
#include <bits/stdc++.h> using namespace std; int N; int ans; int cnt[1000001] = {0}; vector<int> prospects; bool flag=0; void Init(int N_) { N = N_; ans=N; } void Link(int A, int B) { if(prospects.size()==0){ if(ans==0)return; cnt[A]++; cnt[B]++; if(max(cnt[A],cnt[B])>2){ ans=0; if(cnt[A]>2){ prospects.push_back(A); ans++; } if(cnt[B]>2){ prospects.push_back(B); ans++; } } }else if(prospects.size()==1&&!flag){ if(ans==0)return; cnt[A]++; cnt[B]++; if(prospects[0]!=A)swap(A,B); if(prospects[0]==A){ if(cnt[B]==3){ prospects.push_back(B); ans=2; flag=1; } }else{ if(max(cnt[A],cnt[B])>2){ ans=0; } } } else{ if(ans==0)return; cnt[A]++; cnt[B]++; vector<int> sus,not_sus; for(int v : prospects){ if(v==A||v==B)sus.push_back(v); else not_sus.push_back(v); } if(sus.size()==0){ if(max(cnt[A],cnt[B])>2)ans=0; return; }else{ swap(sus,prospects); ans=1; } } } int CountCritical() { return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...