제출 #1034568

#제출 시각아이디문제언어결과실행 시간메모리
1034568irmuun수천개의 섬 (IOI22_islands)C++17
1.75 / 100
61 ms17492 KiB
#include<bits/stdc++.h> #include "islands.h" using namespace std; #define ll long long #define pb push_back #define ff first #define ss second #define all(s) s.begin(),s.end() #define rall(s) s.rbegin(),s.rend() const int maxn=1e5; int n,m; set<pair<int,int>>adj[maxn]; vector<int>ans,r; bool solve(int x){ if(adj[x].size()==0) return false; if(adj[x].size()==1){ auto [y,sail]=*adj[x].begin(); adj[x].erase(adj[x].begin()); ans.pb(sail); r.pb(sail); return solve(y); } else{ auto [y,sail]=*adj[x].begin(); adj[x].erase(adj[x].begin()); auto [z,sail2]=*adj[x].begin(); adj[x].erase(adj[x].begin()); ans.pb(sail); ans.pb(sail^1); ans.pb(sail2); ans.pb(sail2^1); ans.pb(sail^1); ans.pb(sail); ans.pb(sail2^1); ans.pb(sail2); return true; } } variant<bool,vector<int>>find_journey(int N,int M,vector<int>U,vector<int>V){ //sub3 n=N,m=M; for(int i=0;i<m;i++){ adj[U[i]].insert({V[i],i}); } return solve(0); /* if(solve(0)){ reverse(all(r)); ans.insert(ans.end(),all(r)); return ans; } 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...