Submission #835569

#TimeUsernameProblemLanguageResultExecution timeMemory
835569gagik_2007Thousands Islands (IOI22_islands)C++17
9.10 / 100
25 ms7796 KiB
#include "islands.h"
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define ff first
#define ss second

ll ttt;
const ll INF=1e18;
const ll MOD=1e9+7;
const ll N=100007;
ll n,m,k;
vector<int>g[N];
bool used[N];

bool dfs(int v){
    if(used[v])return false;
    used[v]=true;
    if(g[v].size()>=3)return true;
    for(int to:g[v]){
        if(dfs(to))return true;
    }
    return false;
}

variant<bool, vector<int>> find_journey(int NN, int MM, vector<int> U, vector<int> V) {
    n=NN;
    m=MM;
    for(int i=0;i<m;i++){
        g[U[i]].push_back(V[i]);
    }
    if(g[0].size()>=2)return true;
    return dfs(0);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...