This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "bits/stdc++.h"
using namespace std;
#define fr first
#define sc second
const char nl = '\n';
#include "game.h"
const int N = 301;
bitset<N> r[N];
int n, k;
void init(int _n, int _k) {
for(int i = 0; i < N; ++i) {
for(int j = 0; j < N; ++j) r[i][j] = 0;
}
n = _n; k = _k;
for(int i = 0; i < k - 1; ++i) {
for(int j = i + 1; j < k ; ++j) {
r[i][j] = 1;
}
}
}
int add_teleporter(int u, int v) {
r[u][v] = 1;
r[u] = r[u] | r[v];
for(int i = 0; i < n; ++i) {
if(r[i][u]) r[i] = r[i] | r[v];
}
/* for(int i = 0; i < n; ++i) { */
/* for(int j = 0; j < n; ++j) cout << r[i][j]; */
/* cout << nl; */
/* } */
/* cout << nl; */
for(int i = 0; i < k; ++i) {
for(int j = 0; j < n; ++j) {
if(r[i][j] && r[j][i]) return 1;
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |