Submission #1239688

#TimeUsernameProblemLanguageResultExecution timeMemory
1239688AlperenT_Thousands Islands (IOI22_islands)C++20
9.10 / 100
29 ms28704 KiB
#include "islands.h" #include <variant> #include <vector> #include <bits/stdc++.h> //#include "segments.h" #pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2") #define pb push_back #define F first #define pii pair<int,int> #define all(a) a.begin(),a.end() #define S second #define sz(a) (int)a.size() #define rep(i , a , b) for(int i = (a) ; i <= (b) ; i++) #define per(i , a , b) for(int i = (a) ; i >= (b) ; i--) #define ld double #define ll long long using namespace std ; const int maxn = 1e6 + 10 , inf = 1e9+ 10 , mod = 998244353; int mark[maxn] ; vector <pii> G[maxn] ; std::variant<bool, std::vector<int>> find_journey(int n, int m, std::vector<int> U, std::vector<int> V) { rep(i , 0 ,m-1){ G[U[i]].pb({V[i] , i}); } bool ok =0; vector <int> vec ; if(sz(G[0]) >= 2)return true ; if(sz(G[0]) == 0)return false ; int v =G[0][0].F ; mark[0] = 1; while(1){ int nx = -1; mark[v] = 1; for(auto [u,w] : G[v]){ if(nx!=-1 && mark[u] == 0)return true ; if(mark[u] == 0)nx = u ; } v = nx ; if(nx == -1)return false ; } return true ; }
#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...