Submission #710164

# Submission time Handle Problem Language Result Execution time Memory
710164 2023-03-15T05:23:38 Z Astrayt Game (APIO22_game) C++17
0 / 100
7 ms 11992 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define maxn 500005

int N, K;
vector<int> adj[maxn];

void init(int n, int k){
    N = n, K = k;
    for(int i = 0; i < k - 1; ++i) adj[i].pb(i + 1);
}

int add_teleporter(int u, int v){
    adj[u].pb(v);
    vector<bool> vis(N + 5, 0);
    queue<int> bfs;
    bfs.push(0), vis[0] = 1;
    while(bfs.size()){
        int u = bfs.front(); bfs.pop();
        for(auto v:adj[u]){
            if(vis[v]){
                if(v < K) return 1;
                continue;
            }
            bfs.push(v);
            vis[v] = 1;
        }
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 6 ms 11984 KB Output is correct
2 Incorrect 7 ms 11992 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 11984 KB Output is correct
2 Incorrect 7 ms 11992 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 11984 KB Output is correct
2 Incorrect 7 ms 11992 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 11984 KB Output is correct
2 Incorrect 7 ms 11992 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 11984 KB Output is correct
2 Incorrect 7 ms 11992 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -