# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
722660 | bin9638 | Thousands Islands (IOI22_islands) | C++17 | 0 ms | 0 KiB |
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>
#elif
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);
g[v].pb(u);
}
if(g[0].size()>=2)
{
return
#ifdef SKY
{1};
#elif
true;
#endif // SKY
}
DFS(0);
for(int i=1;i<n;i++)
if(ktr[i]==1&&g[i].size()>=3)
{
return
#ifdef SKY
{1};
#elif
true;
#endif // SKY
}
return
#ifdef SKY
{0};
#elif
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