Submission #953752

#TimeUsernameProblemLanguageResultExecution timeMemory
953752De3b0oGame (APIO22_game)C++17
30 / 100
4011 ms35876 KiB
#include "game.h" #include<bits/stdc++.h> using namespace std; bitset<900000000> path(0); int K , N; void init(int n, int k) { N=n; K=k; for(int i = 0 ; k>i ; i++) for(int j = i+1 ; k>j ; j++) path.set(j+i*N); } int add_teleporter(int u, int v) { if(path.test(v+u*N)==1) return 0; path.set(v+u*N); for(int i = 0 ; N>i ; i++) { if(path.test(u+i*N)==1) { for(int j = 0 ; N>j ; j++) { if(path.test(j+v*N)==1) path.set(j+i*N); } } } for(int i = 0 ; N>i ; i++) if(path.test(i+v*N)==1) path.set(i+u*N); for(int i = 0 ; N>i ; i++) if(path.test(u+i*N)==1) path.set(v+i*N); for(int i = 0 ; K>i ; i++) { if(path.test(i+i*N)==1) 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...