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
#define eb emplace_back
const char nl = '\n';
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define dbg(x...) cerr << "LINE(" << __LINE__ << ") -> " <<"[" << #x << "] = ["; _print(x)
#else
#define dbg(x...)
#endif
#include "game.h"
const int N = 300;
bitset<N> r[N];
int n, k;
void init(int _n, int _k) {
n = _n; k = _k;
for(int i = 0; i < k - 1; ++i) {
for(int j = i + 1; j < k ; ++j) {
r[i][j] = 1;
}
}
/* for(int i = 0; i < n; ++i) { */
/* for(int j = 0; j < n; ++j) */
/* cout << r[i][j]; */
/* cout << nl; */
/* } */
/* cout << nl; */
}
int add_teleporter(int u, int v) {
if(r[u][v]) return 0;
r[u][v] = 1;
for(int i = 0; i < n; ++i) {
if(r[i][u]) r[i] |= r[v];
}
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... |