이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <stdio.h>
#include <assert.h>
#include <string.h>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <random>
#include <bitset>
#include <string>
#include <cstring>
#include <set>
#include <vector>
#include <map>
#include <stack>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))
#define mp make_pair
#define f first
#define se second
#define pb push_back
#define ppb pop_back
#define ll long long
#define ull unsigned long long
#define cntbit(x) __builtin_popcount(x)
#define endl '\n'
#define uset unordered_set
#define umap unordered_map
#define pii pair<int, int>
#define ld long double
#define pll pair<long long, long long>
const int inf = 2e9;
const int N = 2e3 + 15;
int n, deg[N][N], sz[N], p[N];
bitset <N> comp[N], can_be[N];
void initialize(int N) {
n = N;
for(int i = 0; i < n; ++i) {
for(int j = 0; j < n; ++j)
can_be[i][j] = 1;
p[i] = i, sz[i] = 1;
comp[i][i] = 1;
can_be[i][i] = 0;
}
}
int find(int v) {
if(v == p[v])
return v;
return p[v] = find(p[v]);
}
void unio(int a, int b) {
a = find(a);
b = find(b);
if(a != b) {
if(sz[a] < sz[b])
swap(a, b);
sz[a] += sz[b];
p[b] = a;
comp[a] |= comp[b];
can_be[a] &= can_be[b];
}
}
int hasEdge(int u, int v) {
u = find(u);
v = find(v);
can_be[u] = (can_be[u] | comp[v]) ^ (comp[v]);
can_be[v] = (can_be[v] | comp[u]) ^ (comp[u]);
if((can_be[find(u)] & can_be[find(v)])._Find_first() >= n) {
unio(u, v);
return 1;
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
game.cpp: In function 'int hasEdge(int, int)':
game.cpp:77:55: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if((can_be[find(u)] & can_be[find(v)])._Find_first() >= n) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |