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 <bits/stdc++.h>
#ifndef SKY
#include "islands.h"
#endif // SKY
using namespace std;
#define N 100010
#define ll long long
#define fs first
#define sc second
#define ii pair<int,int>
#define pb push_back
int n,m,ktr[N];
vector<int>g[N];
void DFS(int u)
{
ktr[u]=1;
for(auto v:g[u])
if(ktr[v]==0)
DFS(v);
}
#ifdef SKY
vector<int>
#endif // SKY
#ifndef SKY
variant<bool, vector<int>>
#endif // SKY
find_journey(int NNN, int MMM, vector<int> canh_fs, vector<int> canh_sc)
{
n=NNN;
m=MMM;
for(int i=0;i<m;i++)
{
int u=canh_fs[i],v=canh_sc[i];
g[u].pb(v);
}
if(n==2)
{
if(g[0].size()>=2&&g[1].size()>=1)
{
return
#ifdef SKY
{1};
#endif // SKY
#ifndef SKY
true;
#endif // SKY
}else
{
return
#ifdef SKY
{0};
#endif // SKY
#ifndef SKY
false;
#endif // SKY
}
}
if(g[0].size()>=2)
{
return
#ifdef SKY
{1};
#endif // SKY
#ifndef SKY
true;
#endif // SKY
}
DFS(0);
for(int i=1;i<n;i++)
if(ktr[i]==1&&g[i].size()>=3)
{
return
#ifdef SKY
{1};
#endif // SKY
#ifndef SKY
true;
#endif // SKY
}
return
#ifdef SKY
{0};
#endif // SKY
#ifndef SKY
false;
#endif // SKY
}
#ifdef SKY
int main()
{
freopen("A.inp","r",stdin);
freopen("A.out","w",stdout);
ios::sync_with_stdio(0);
cin.tie(NULL);
cout.tie(NULL);
return 0;
}
#endif
# | 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... |