이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
#define fastio ios::sync_with_stdio(false), cin.tie(0)
#define pb push_back
#define eb emplace_back
#define f first
#define s second
#include "game.h"
const int maxn = 3e5 + 5;
vector<int> adj[maxn];
int mx[maxn];
int n, k;
void init(int _n, int _k) {
n = _n, k = _k;
for(int i = 0; i < n; i++){
if(i < k) mx[i] = i - 1;
else mx[i] = -1;
}
for(int i = 0; i < k - 1; i++) adj[i].pb(i + 1);
}
int add_teleporter(int u, int v) {
adj[u].pb(v);
queue<int> q;
q.push(u);
while(!q.empty()){
int pos = q.front(); q.pop();
int c = (u < k ? u : mx[u]);
for(auto x : adj[pos]){
if(c > mx[x]){
mx[x] = c;
if(x < k && c >= x) return 1;
q.push(x);
}
}
}
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... |