제출 #1079138

#제출 시각아이디문제언어결과실행 시간메모리
1079138NourWael수천개의 섬 (IOI22_islands)C++17
1.75 / 100
88 ms12752 KiB
#include "islands.h" #include <bits/stdc++.h> //#include "grader.cpp" using namespace std; int const mxN = 1e3+5; vector<pair<int,int>> adj[mxN], adj2[mxN]; int n,m, cnt[mxN][mxN]; bool vis[mxN], poss[mxN]; vector<int> from[mxN]; void dfs ( int i ) { for(auto it:adj[i]) { if(it.first==0 || vis[it.first]) continue; vis[it.first] = 1; dfs(it.first); } } variant<bool,vector<int>> find_journey( int N, int M,vector<int> U, vector<int> V) { n = N, m = M; for(int i=0; i<m; i++) { adj[U[i]].push_back({V[i],i}), adj2[V[i]].push_back({U[i],i}); cnt[U[i]][V[i]]++; } for(auto it:adj[0]) { memset(vis,0,sizeof vis); vis[it.first] = 1; dfs(it.first); for(int i=1; i<n; i++) { if(vis[i]) from[i].push_back(it.first); } } bool f = 0; for(int i=1; i<n; i++) if(from[i].size()>1) f = 1; for(int i=1; i<n; i++) if(cnt[0][i]>1 ) f = 1; vector<int> v; if(f) return v; else 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...