Submission #718553

# Submission time Handle Problem Language Result Execution time Memory
718553 2023-04-04T10:04:12 Z lam Game (APIO22_game) C++17
0 / 100
1 ms 976 KB
#include "game.h"
#include <bits/stdc++.h>
using namespace std;
int n,k;
typedef pair<int,int> ii;
#define ff first
#define ss second
const int maxn = 3e4 + 10;
vector <int> adj[maxn];
bool vis[1010][maxn];
stack<int> st;
bool dau[maxn];
bool ccheck = 0;
void dfs(int id, int x)
{
    vis[id][x] = 1;
    if (x <= id) ccheck = 1;
    for (int i:adj[x])
        if (!vis[id][i]) dfs(id,i);
}

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

int add_teleporter(int u, int v) {
    u++; v++;
    adj[u].push_back(v);
    for (int i=1; i<=k; i++)
        if ((u==k||vis[i][u])&&!vis[i][v]) dfs(i,v);
    return ccheck;
}

# Verdict Execution time Memory Grader output
1 Correct 1 ms 976 KB Output is correct
2 Incorrect 1 ms 976 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 976 KB Output is correct
2 Incorrect 1 ms 976 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 976 KB Output is correct
2 Incorrect 1 ms 976 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 976 KB Output is correct
2 Incorrect 1 ms 976 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 976 KB Output is correct
2 Incorrect 1 ms 976 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -