Submission #438426

#TimeUsernameProblemLanguageResultExecution timeMemory
438426adamjinweiGame (IOI14_game)C++14
0 / 100
1 ms308 KiB
#include <bits/stdc++.h> #include "game.h" #define inf 1000000007 #define mod 1000000007 #define rnd() rand_num() #define bigrnd() dis(rand_num) //#pragma GCC optimize("Ofast","inline","-ffast-math") //#pragma GCC target("avx,sse2,sse3,sse4,mmx") //#define int long long using namespace std; unsigned sed=std::chrono::system_clock::now().time_since_epoch().count(); mt19937 rand_num(sed); uniform_int_distribution<long long> dis(0,inf); template <typename T> void read(T &x){ x=0;char ch=getchar();int fh=1; while (ch<'0'||ch>'9'){if (ch=='-')fh=-1;ch=getchar();} while (ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar(); x*=fh; } template <typename T> void write(T x) { if (x<0) x=-x,putchar('-'); if (x>9) write(x/10); putchar(x%10+'0'); } template <typename T> void writeln(T x) { write(x); puts(""); } int n; int fa[1505]; int cnt; int fnd(int x) { if(fa[x]!=x) fa[x]=fnd(fa[x]); return fa[x]; } void initialize(int N) { n=N; for(int i=1;i<=n;++i) fa[i]=i; cnt=n; } int hasEdge(int u,int v) { u++,v++; int fx=fnd(u),fy=fnd(v); int nxt=cnt-(fx==fy?0:1); if(nxt>1) { fa[fx]=fy; cnt=nxt; return 1; } else return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...