Submission #1165089

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
11650892025-03-11 03:54:52boclobanchatGame (IOI14_game)C++20
15 / 100
0 ms328 KiB
#include"game.h"
#include<bits/stdc++.h>
using namespace std;
int dsu[1666],F[1666][1666],cnt[1666];
int root(int i)
{
if(!dsu[i]) return i;
return dsu[i]=root(dsu[i]);
}
void merge(int i,int j)
{
if((i=root(i))==(j=root(j))) return ;
dsu[j]=i,cnt[i]+=cnt[j];
}
void initialize(int n)
{
for(int i=1;i<=n;i++) cnt[i]=1;
return ;
}
int hasEdge(int u,int v)
{
u=root(++u),v=root(++v);
if(u>v) swap(u,v);
if(++F[u][v]==cnt[u]*cnt[v])
{
merge(u,v);
return 1;
}
return 0;
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...