Submission #985248

# Submission time Handle Problem Language Result Execution time Memory
985248 2024-05-17T13:47:10 Z ph0enlx Game (APIO22_game) C++17
0 / 100
2 ms 7256 KB
#include<bits/stdc++.h>
using namespace std;
const int N = 3e5+10;
vector<int> g[N];
int ng, kg;

void dfs(int ver, int par, bool &exist, vector<bool> &vis)
{
    vis[ver] = true;
    for(int child : g[ver])
    {
        if(vis[child])
        {
            if(child!=par)
            {
                exist = true;
                return;
            }
            continue;
        }
        dfs(child, ver, exist, vis);
    }
}

void init(int n, int k)
{
    ng = n, kg = k;
    for(int i=0; i<k-1; i++)
    {
        g[i].push_back(i+1);
    }
}

int add_teleporter(int u, int v)
{
    return 1;
    if(u==v) return 1;
    g[u].push_back(v);
    vector<bool> vis(ng);
    bool exist=false;
    for(int i=0; i<kg; i++)
    {
        if(vis[i]) continue;
        dfs(i, i, exist, vis);
        if(exist) return 1;
    }

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