Submission #1235698

#TimeUsernameProblemLanguageResultExecution timeMemory
1235698marizaThousands Islands (IOI22_islands)C++20
1.75 / 100
18 ms5192 KiB
#include "islands.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; variant<bool, vector<int>> find_journey(int n, int m, vector<int> u, vector<int> v) { vector<ll> g[n]; for(ll i=0; i<m; i++){ g[u[i]].push_back(v[i]); } if(g[0].size()==0) return false; else if(g[0].size()>=2) return true; else{ ll curr=g[0][0], prev=0; while(g[curr].size()<=2){ if(g[curr].size()==1) return false; else if(g[curr].size()>=3) return true; else{ ll nxt; if(g[curr][0]==prev) nxt=g[curr][1]; else nxt=g[curr][0]; prev=curr; curr=nxt; } } } }

Compilation message (stderr)

islands.cpp: In function 'std::variant<bool, std::vector<int, std::allocator<int> > > find_journey(int, int, std::vector<int>, std::vector<int>)':
islands.cpp:29:1: warning: control reaches end of non-void function [-Wreturn-type]
   29 | }
      | ^
#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...