# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
642544 | danikoynov | Game (APIO22_game) | C++17 | 2725 ms | 119544 KiB |
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>
#define endl '\n'
using namespace std;
typedef long long ll;
const int maxk = 5010, maxn = 30010;
vector < int > g[maxn];
int used[maxk][maxn], tf, K;
void add_edge(int i, int u, int v)
{
if (used[i][u] == 0)
return;
if (used[i][v])
{
if (v <= i)
tf = 1;
return;
}
queue < int > q;
q.push(v);
used[i][v] = 1;
while(!q.empty())
{
int cur = q.front();
///cout << i << " :: " << cur << endl;
q.pop();
if (cur <= i)
tf = 1;
for (int nb : g[cur])
{
if (used[i][nb] == 0)
{
used[i][nb] = 1;
q.push(nb);
}
else
if (nb <= i)
tf = 1;
}
}
}
void init(int n, int k)
{
K = k;
for (int i = 0; i < k; i ++)
for (int j = i; j < k; j ++)
used[i][j] = 1;
}
int add_teleporter(int u, int v)
{
g[u].push_back(v);
for (int i = 0; i < K; i ++)
{
add_edge(i, u, v);
}
return tf;
}
Compilation message (stderr)
# | 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... |