제출 #1061612

#제출 시각아이디문제언어결과실행 시간메모리
1061612jamjanek수천개의 섬 (IOI22_islands)C++17
9.10 / 100
21 ms7892 KiB
#include "islands.h" #include <variant> #include <vector> #include<bits/stdc++.h> using namespace std; int odw[100010]; vector<pair<int, int>>graf[100010]; void dfs(int x, int kra){ for(auto j: graf[x]){ if(kra/2!=j.second/2){ odw[j.first]++; if(odw[j.first]==1) dfs(j.first, j.second); } } } std::variant<bool, std::vector<int>> find_journey(int n, int m, std::vector<int> U, std::vector<int> V) { int i; for(i=0;i<m;i+=2){ graf[U[i]].push_back({V[i], i}); graf[V[i]].push_back({U[i], i+1}); } odw[0] = 1; dfs(0, -2); if(graf[0].size()>1){ vector<int>ans = {graf[0][0].second, graf[0][0].second^1, graf[0][1].second, graf[0][1].second^1, graf[0][0].second^1, graf[0][0].second^1^1, graf[0][1].second^1, graf[0][1].second^1^1,}; return ans; } for(i=0;i<n;i++) if(odw[i]>0 && graf[i].size()>2) 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...