This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "game.h"
#include <bits/stdc++.h>
using namespace std;
int N,K;
bitset<30005> vis[1001];
vector<int> v[30005];
void init(int n, int k) {
N=n;
K=k;
for(int i=0;i<k-1;i++){
v[i].push_back(i+1);
vis[i][i]=1;
}
vis[k-1][k-1]=1;
}
queue<int> q;
int add_teleporter(int x, int y) {
v[x].push_back(y);
for(int i=K-1;i>=0;i--){
if(!vis[i][x]) continue;
q.push(x);
vis[i][x]=1;
while(!q.empty()){
int a=q.front();
q.pop();
for(int j:v[a]){
if(j<=i) return 1;
if(!vis[i][j]){
vis[i][j]=1;
q.push(j);
}
}
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |