| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 30467 | inqr | Game (IOI14_game) | C++14 | 3 ms | 19668 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "game.h"
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define rt insert
#define st first
#define nd second
#define ll long long
#define pii pair < int , int >
#define DB printf("debug\n");
#define umax( x , y ) x = max( x , (y) )
#define umin( x , y ) x = min( x , (y) )
#define all(x) x.begin() , x.end()
using namespace std;
int conto[1505];
int conto2[1505][1505];
int root[1505];
int N,totno,maxque,maxyes,maxno;
int rootfind(int a){
if(root[a]==a)return a;
return root[a]=rootfind(root[a]);
}
void merge(int a,int b){
int x=a,y=b;
root[a]=root[b]=max(rootfind(a),rootfind(b));
}
void initialize(int n) {
N=n;
maxque=(n)*(n-1)/(2);
maxyes=n-1;
maxno=maxque-maxyes;
memset(conto2,1,sizeof(conto2));
for(int i=0;i<n;i++){
root[n]=n;
conto[n]=0;
conto2[n][n]=0;
}
//printf("n=%d maxque=%d maxyes=%d maxno=%d\n",n,maxque,maxyes,maxno);
}
int hasEdge2(int u,int v){
int ur=rootfind(u),uv=rootfind(v);
if(conto2[ur][uv]==1){
merge(u,v);
int rn=rootfind(u);
for(int i=0;i<N;i++){
if(rootfind(i)==rn){
conto2[i][rn]=conto2[rn][i]=conto2[ur][rn]+conto2[uv][rn];
}
}
return 1;
}
conto2[ur][uv]--;
conto2[uv][ur]--;
return 0;
}
int hasEdge(int u, int v) {
return hasEdge2(u,v);
conto[max(u,v)]++;
if(conto[max(u,v)]==max(u,v))return 1;
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
