제출 #1079170

#제출 시각아이디문제언어결과실행 시간메모리
1079170NourWael수천개의 섬 (IOI22_islands)C++17
9.10 / 100
37 ms12320 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]; bool flag = 0; void dfs ( int i ) { for(auto it:adj[i]) { if(vis[it.first]) continue; vis[it.first] = 1; if(adj[it.first].size()>2) { flag = 1; return; } 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(adj[0].size()>1) return v; else { vis[0] = 1; dfs(0); } if(flag) return v; return false; }

컴파일 시 표준 에러 (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:35:8: warning: variable 'f' set but not used [-Wunused-but-set-variable]
   35 |   bool f = 0;
      |        ^
#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...