Submission #983824

# Submission time Handle Problem Language Result Execution time Memory
983824 2024-05-16T07:01:40 Z vjudge1 Game (APIO22_game) C++17
0 / 100
1 ms 1112 KB
#include "game.h"
#include<bits/stdc++.h>
using namespace std;
const int N = 3e4 + 100;
vector<int> g[N];
bool flag = 0;
int k, visited[N], n;
void dfs(int x) {
    visited[x] = 1;
    for (auto to : g[x]) {
        if (!visited[to])
            dfs(to);
        else if (to < k)
            flag = 1;
    }
}
void init(int n, int k) {
    ::k = k;
    ::n = n;
    for (int i = 0; i < k - 1; i++) {
        g[i].push_back(i + 1);
    }
}

int add_teleporter(int u, int v) {
    g[u].push_back(v);
    for (int i = 0; i < n; i++) {
        visited[i] = 0;
    }
    for (int i = 0; i < k; i++) {
        if (!visited[i])
            dfs(i);
    }
    return flag;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1112 KB Output is correct
2 Incorrect 1 ms 1112 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1112 KB Output is correct
2 Incorrect 1 ms 1112 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1112 KB Output is correct
2 Incorrect 1 ms 1112 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1112 KB Output is correct
2 Incorrect 1 ms 1112 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1112 KB Output is correct
2 Incorrect 1 ms 1112 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -