Submission #982703

# Submission time Handle Problem Language Result Execution time Memory
982703 2024-05-14T16:19:48 Z vjudge1 Game (APIO22_game) C++17
0 / 100
0 ms 344 KB
#include "game.h"
#include <algorithm>
#include <fstream>
#include <vector>
#include <queue>
#include <stack>
#include <iostream>
#include <cmath>
#include <queue>
#include <set>
#include <string>
#include <cstring>
#include <map>
#include <unordered_map>
#include <unordered_set>
#define F first
#define S second
#define PB push_back
using namespace std;
const long long MOD=1e9+7, INF=1e18;
const int INFI=1e9;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<pair<int, ii>> viii;
typedef vector<vii> vvii;
typedef vector<ll> vll;
typedef vector<vll> vvll;

int n, k;
vvi al;
bool vis[300005];
void init(int N, int K){
    n=N;    k=K;
    al.resize(n+1, vi());
    for(int i=0;i<k-1;i++)
        al[i].PB(i+1);
}
bool dfs(int node){
    bool ans=false;
    if(vis[node] && node<k)   return 1;
    else if(vis[node])  return 0;
    vis[node]=true;
    for(auto ch:al[node]){
        if(dfs(ch)) ans=true;
    }
    return ans;
}
int add_teleporter(int u, int v){
    al[u].PB(v);
    for(int i=0;i<k;i++){
        memset(vis, false, n+1);
        if(dfs(i))  return 1;
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -