This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <vector>
using namespace std;
const int N = 3e4 + 5;
vector<int> nei[N];
int n,k;
int Mnr[N];
bool ans = false;
void dfs(int u,int p = -1){
for (int i : nei[u]){
int Mn = Mnr[u];
if (u <= k)
Mn = u;
if (Mn < Mnr[i])
Mnr[i] = Mn,dfs(i,u);
}
}
int add_teleporter(int u,int v){
u++;
v++;
nei[v].push_back(u);
dfs(v);
for (int i=1;i<=k;i++)
if (Mnr[i] <= i)
return 1;
return 0;
}
void init(int NN,int KK){
n = NN,k = KK;
for (int i=1;i<=k;i++)
Mnr[i] = i+1;
for (int i=k+1;i<=n;i++)
Mnr[i] = 1e9;
}
# | 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... |