이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "game.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define fi first
#define se second
#define mp make_pair
int n, k;
const int N = (int)3e5 + 10;
int low[N];
void init(int _n, int _k) {
n = _n;
k = _k;
for(int i = 0 ; i < n; i ++ ){
low[i] = n + 1;
}
}
vector<int> in[N];
bool sol = false;
void dfs(int u, int val){
low[u]=val;
if(u < k && low[u] <= u){
sol = true;
}
if(sol) return;
for(auto x : in[u]){
if(low[x] > val){
dfs(x, val);
}
}
}
int add_teleporter(int u, int v) {
if(v < k){
if(low[u] > v)
dfs(u, v);
}
else{
if(low[u] > low[v]){
dfs(u, low[v]);
}
}
in[v].push_back(u);
return sol;
}
# | 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... |