Submission #1016639

#TimeUsernameProblemLanguageResultExecution timeMemory
1016639simona1230Game (IOI14_game)C++17
15 / 100
1 ms4444 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) { 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]==l[v])l[i]=l[u]; 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...