Submission #718547

# Submission time Handle Problem Language Result Execution time Memory
718547 2023-04-04T09:59:05 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<=n; i++)
        dfs(i,i);
}

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


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