이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "game.h"
#include<bits/stdc++.h>
#define LL int
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define I insert
#define Max(a,b) ((b<a)?a:b)
#define Min(a,b) ((a<b)?a:b)
const LL N = 1503, mod = 1000000007;
using namespace std;
LL n, m, i, j, k, l, r, t, ans;
LL fix[N], a[N][N];
vector < LL > g[N];
void initialize ( LL nn ){
n = nn;
for ( LL i = 0; i < n; ++i ){
fix[i] = i;
g[i].PB(i);
}
}
LL hasEdge ( LL u, LL v ){
LL x = fix[u];
LL y = fix[v];
if ( g[x].size() < g[y].size() ) swap ( x, y );
if ( a[x][y] + 1 != g[x].size() * g[y].size() ){
a[x][y]++;
a[y][x]++;
return 0;
}
for ( LL i = 0; i < g[y].size(); ++i ){
g[x].PB(g[y][i]);
fix[g[y][i]] = x;
}
g[y].clear();
for ( LL i = 0; i < n; ++i ){
a[x][i] += a[y][i];
a[i][x] += a[i][y];
}
return 1;
}
// IIIIIIIII OOOOO A NN N EEEEEEEEEE
// I O O A A N N N E
// I O O A A N N N E
// I O O A A N N N E
// I O O AAAAAAAAA N N N EEEEEEEE
// I O O A A N N N E
// I O O A A N N N E
// I O O A A N N N E
// IIIIIIIII OOOOO A A N NN EEEEEEEEEE ___ KAPANADZE
컴파일 시 표준 에러 (stderr) 메시지
game.cpp: In function 'int hasEdge(int, int)':
game.cpp:35:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if ( a[x][y] + 1 != g[x].size() * g[y].size() ){
~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
game.cpp:41:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for ( LL i = 0; i < g[y].size(); ++i ){
~~^~~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |