제출 #1348899

#제출 시각아이디문제언어결과실행 시간메모리
1348899thelegendary08게임 (APIO22_game)C++17
60 / 100
1082 ms311780 KiB
#include "game.h"
// #define int long long
#define f0r(i,n) for(int i = 0; i < n; i++)
#define FOR(i,k,n) for(int i = k; i < n; i++)
#define vi vector<int>
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define dout(x) cout<<x<<' '<<#x<<endl
#define dout2(x,y) cout<<x<<' '<<#x<<' '<<y<<' '<<#y<<endl
#define vout(v) cout<<#v<<": "; for(auto u : v)cout<<u<<' '; cout<<endl
#include<bits/stdc++.h>
using namespace std; 
const int mxn = 3e5 + 5, mxk = 1e3 + 5;
int n, k; bool f[mxn][mxk]; vi adj[mxn]; 
void init(int n, int k) {
	::n=n,::k=k; f0r(i,k)FOR(j,i+1,k)f[j][i]=1; f0r(i,k-1)adj[i].pb(i+1); 
}

int add_teleporter(int u, int v) {
	if(u==v){
		if(u<k)return 1; else return 0; 
	}
	adj[u].pb(v); 
	f0r(i,k)if(((f[u][i] || i == u) && !f[v][i])){
		// if(u==1)dout(i);
		f[v][i]=1; if(v<k&&v<=i)return 1; queue<int>q; q.push(v); while(!q.empty()){
			int node = q.front(); q.pop(); for(auto x : adj[node])if(!f[x][i]){
				f[x][i]=1; if(x<k&&x<=i)return 1; q.push(x); 
			}
		}
	}
	// f0r(i,n)cout<<f[1][i]<<' '; cout<<'\n';
	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...