제출 #731543

#제출 시각아이디문제언어결과실행 시간메모리
731543ogibogi2004게임 (APIO22_game)C++17
60 / 100
4048 ms25076 KiB
#include "game.h" #include <bits/stdc++.h> using namespace std; const int MAXN=3e5+6; int min_nxt[MAXN]; vector<int>gr[MAXN]; int n,k; void init(int _n, int _k) { n=_n;k=_k; for(int i=0;i<n;i++) { min_nxt[i]=n+1; } } bool set_min(int u,int val) { min_nxt[u]=val; if(u<k&&min_nxt[u]<=u)return 1; for(auto xd:gr[u]) { if(min_nxt[xd]>val) { bool flag=set_min(xd,val); if(flag==1)return 1; } } return 0; } int add_teleporter(int u, int v) { gr[v].push_back(u); if(u<k&&v<k) { if(u>=v)return 1; else return 0; } if(v<k) { if(v>=min_nxt[u])return 0; bool flag=set_min(u,v); return flag; } else if(min_nxt[v]>=min_nxt[u])return 0; bool flag=set_min(u,min_nxt[v]); return flag; }
#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...