Submission #1061545

#TimeUsernameProblemLanguageResultExecution timeMemory
1061545jamjanekThousands Islands (IOI22_islands)C++17
5 / 100
20 ms6796 KiB
#include "islands.h" #include <variant> #include <vector> #include<bits/stdc++.h> using namespace std; int odw[100010]; vector<int>graf[100010]; void dfs(int x){ for(auto j: graf[x]){ odw[j]++; if(odw[j]==1) dfs(j); } } std::variant<bool, std::vector<int>> find_journey(int n, int m, std::vector<int> U, std::vector<int> V) { if(n==2){ vector<int> powrot, tam; for(int i=0;i<m;i++){ if(U[i]==0) tam.push_back(i); else powrot.push_back(i); } if(tam.size()<2 || powrot.size()<1)return false; vector<int>ans = {tam[0], powrot[0], tam[1], tam[0], powrot[0], tam[1]}; return ans; } int i; for(i=0;i<m;i+=2){ graf[U[i]].push_back(V[i]); } odw[0] = 1; dfs(0); for(i=0;i<n;i++) if(odw[i]>1) return true; return false; }
#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...