Submission #1079144

#TimeUsernameProblemLanguageResultExecution timeMemory
1079144NourWaelThousands Islands (IOI22_islands)C++17
1.75 / 100
77 ms11476 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(adj[0].size()>1) return v; else return false; }

Compilation message (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:34:8: warning: variable 'f' set but not used [-Wunused-but-set-variable]
   34 |   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...