Submission #739133

# Submission time Handle Problem Language Result Execution time Memory
739133 2023-05-10T03:11:48 Z PixelCat Game (APIO22_game) C++17
0 / 100
0 ms 208 KB
#include "game.h"
#ifdef NYAOWO
#include "grader.cpp"
#endif

#include <bits/stdc++.h>
#define For(i, a, b) for(int i = a; i <= b; i++)
#define Forr(i, a, b) for(int i = a; i >= b; i--)
#define F first
#define S second
#define sz(x) ((int)x.size())
#define all(x) x.begin(), x.end()
#define eb emplace_back
using namespace std;
using LL = long long;
using pii = pair<int, int>;

const int MAXN = 1010;

int n, k;
vector<int> adj[MAXN];
int vis[MAXN];

void init(int _n, int _k) {
    n = _n; k = _k;
    For(i, 0, n - 1) adj[i].clear();
    For(i, 0, k - 2) adj[i].eb(i + 1);
}

int dfs(int x) {
    if(vis[x] != -1) return vis[x];
    vis[x] = -2;
    for(auto &i:adj[x]) {
        if(i < k && vis[i] == -2) return vis[x] = 1;
        if(vis[i] == -2) continue;
        if(dfs(i)) return vis[x] = 1;
    }
    return vis[x] = 0;
}

int add_teleporter(int u, int v) {
    memset(vis, -1, sizeof(vis));
    adj[u].eb(v);
    return dfs(1);
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Wrong Answer[1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Wrong Answer[1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Wrong Answer[1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Wrong Answer[1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Wrong Answer[1]
2 Halted 0 ms 0 KB -