Submission #409454

#TimeUsernameProblemLanguageResultExecution timeMemory
409454MDarioGame (IOI14_game)C++11
15 / 100
5 ms1104 KiB
#include "game.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; #define F first #define S second int a[1501][1501], a1[1501]; set<int> s[1501]; void initialize(int n) { for(int i=0; i<n; i++){ for(int t=i+1; t<n; t++){ a[i][t]=-1; a[t][i]=-1; a1[i]+=t; a1[t]+=i; s[i].insert(t); s[t].insert(i); } } return ; } int hasEdge(int u, int v){ if(a[u][v]!=-1)return a[u][v]; a[u][v]=0; a[v][u]=0; s[u].erase(v); s[v].erase(u); a1[u]-=v; a1[v]-=u; int c=0; while(s[u].size()==1){ a[u][a1[u]]=1; a[a1[u]][u]=1; s[u].erase(a1[u]); s[a1[u]].erase(u); a1[a1[u]]-=u; c=u; u=a1[u]; a1[c]=0; } while(s[v].size()==1){ a[v][a1[v]]=1; a[a1[v]][v]=1; s[v].erase(a1[v]); s[a1[v]].erase(v); a1[a1[v]]-=v; c=v; v=a1[v]; a1[c]=0; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...