Submission #1016651

#TimeUsernameProblemLanguageResultExecution timeMemory
1016651simona1230Game (IOI14_game)C++17
100 / 100
259 ms21852 KiB
#include "game.h" #include <bits/stdc++.h> using namespace std; int n; int l[1501]; int ways[1501][1501]; void initialize(int N) { n=N; for(int i=0;i<n;i++) l[i]=i; for(int i=0;i<n;i++) for(int j=0;j<n;j++) ways[i][j]=1; } int hasEdge(int u, int v) { if(l[u]!=l[v]&&ways[l[u]][l[v]]==1) { int t1=l[u]; int t2=l[v]; ways[l[u]][l[v]]--; ways[l[v]][l[u]]--; for(int i=0;i<n;i++) { ways[l[u]][i]+=ways[l[v]][i]; ways[i][l[u]]=ways[l[u]][i]; } for(int i=0;i<n;i++) if(l[i]==t2)l[i]=t1; /*for(int i=0;i<n;i++) cout<<l[i]<<" "; cout<<endl; for(int i=0;i<n;i++) for(int j=0;j<n;j++) cout<<i<<" "<<j<<" "<<ways[i][j]<<endl;*/ return 1; } ways[l[u]][l[v]]--; ways[l[v]][l[u]]--; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...