# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
920430 | Nika533 | 게임 (IOI14_game) | C++17 | 2 ms | 2392 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#pragma GCC diagnostic warning "-std=c++11"
#include <bits/stdc++.h>
#include "game.h"
#define pb push_back
#define f first
#define s second
#define MOD 1000000007
#define flush fflush(stdout)
#define all(x) (x).begin(),(x).end()
#define allr(x) (x).rbegin(), (x).rend()
using namespace std;
const int N=4005;
int n,k,m,cnt;
int ind[N],sz[N],q[N][N];
vector<int> C[N];
void merge(int a, int b) {
int c=(++cnt);
sz[c]=sz[a]+sz[b];
C[c].pb(a); C[c].pb(b);
for (int x=0; x<C[a].size(); x++) C[c].pb(C[a][x]);
for (auto x:C[b]) C[c].pb(x);
for (auto x:C[c]) ind[x]=c;
for (int i=1; i<=n; i++) {
q[c][i]+=q[c][a]; q[i][c]+=q[a][c];
q[c][i]+=q[c][b]; q[i][c]+=q[b][c];
}
}
void initialize(int n1) {
n=n1; cnt=n;
for (int i=1; i<=n; i++) {
ind[i]=i; sz[i]=1;
}
}
int hasEdge(int u, int v) {
u=ind[u]; v=ind[v]; q[u][v]++; q[v][u]++;
if (sz[u]*sz[v]==q[u][v]) {
merge(u,v);
return 1;
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |