Submission #744279

#TimeUsernameProblemLanguageResultExecution timeMemory
744279saayan007Game (APIO22_game)C++17
30 / 100
23 ms428 KiB
#include "bits/stdc++.h"
using namespace std;

#define fr first
#define sc second
const char nl = '\n';
#include "game.h"

const int N = 1001;
int n, k;
/* vector<vector<bool>> reach; */
bitset<N> reach[N];
void init(int _n, int _k) {
    n = _n; k = _k;
    for(int i = 0; i < k - 1; ++i) {
        for(int j = i + 1; j < k; ++j) {
            reach[i][j] = 1;
        }
    }
}

int add_teleporter(int u, int v) {
    reach[u][v] = 1;
    reach[u] |= reach[v];
    for(int i = 0; i < n; ++i) {
        if(!reach[i][u]) continue;
        reach[i] |= reach[u];
    }

    for(int i = 0; i < k; ++i) if(reach[i][i]) return 1;
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...