Submission #972753

#TimeUsernameProblemLanguageResultExecution timeMemory
972753tamir1Game (APIO22_game)C++17
60 / 100
555 ms6448 KiB
#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 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...