Submission #730416

#TimeUsernameProblemLanguageResultExecution timeMemory
730416caganyanmazThousands Islands (IOI22_islands)C++17
0 / 100
1000 ms2097152 KiB
#include <bits/stdc++.h> #define pb push_back #define pp pop_back using namespace std; vector<array<int, 2>> edges; vector<vector<int>> g; vector<bool> visited; vector<int> path; vector<int> res; bool dfs(int node) { if (visited[node]) { for (int i : path) res.pb(i); int i; for (i = 0; edges[path[i]][0] != node; i++); for (int j = i; j < path.size(); j++) res.pb(path[i]+1); for (int j = path.size()-1; j >= i; j--) res.pb(path[j]); for (int j = path.size()-1; j >= i; j--) res.pb(path[j]+1); for (int j = i-1; j >= 0; j--) res.pb(path[j]); return true; } for (int edge : g[node]) { path.pb(edge); if(dfs(edges[edge][1])) return true; } return false; } variant<bool, vector<int>> find_journey(int n, int m, vector<int> u, vector<int> v) { edges = vector<array<int, 2>>(m); g = vector<vector<int>>(n); visited = vector<bool>(n); for (int i = 0; i < m; i+=2) { edges[i][0] = u[i], edges[i][1] = v[i]; g[u[i]].pb(i); } if(dfs(0)) return res; return false; }

Compilation message (stderr)

islands.cpp: In function 'bool dfs(int)':
islands.cpp:20:35: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |                 for (int j = i; j < path.size(); j++)
      |                                 ~~^~~~~~~~~~~~~
#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...