Submission #710023

# Submission time Handle Problem Language Result Execution time Memory
710023 2023-03-15T03:46:57 Z Astrayt Game (APIO22_game) C++17
0 / 100
4 ms 7248 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define maxn 300005

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

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

int add_teleporter(int u, int v){
    if(u == v){
        if(u <= K) return 1;
        return 0;
    }
    adj[u].pb(v);
    vector<int> vis(N + 1, 0);
    queue<int> bfs;
    bfs.push(1), vis[1] = 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;
}

/*int main(){
    int n, m, k; cin >> n >> m >> k;
    init(n, k);
    bool ok = 1;
    for(int i = 1; i <= m; ++i){
        int u, v; cin >> u >> v;
        int r = add_teleporter(u + 1, v + 1);
        cout << r << '\n';
        if(r) {
            cout << i << '\n';
            ok = 0;
            break;
        }
    }
    if(ok) cout << m << '\n';
}
*/
# Verdict Execution time Memory Grader output
1 Correct 4 ms 7248 KB Output is correct
2 Incorrect 4 ms 7248 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 7248 KB Output is correct
2 Incorrect 4 ms 7248 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 7248 KB Output is correct
2 Incorrect 4 ms 7248 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 7248 KB Output is correct
2 Incorrect 4 ms 7248 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 7248 KB Output is correct
2 Incorrect 4 ms 7248 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -