Submission #1061652

#TimeUsernameProblemLanguageResultExecution timeMemory
1061652jamjanekThousands Islands (IOI22_islands)C++17
Compilation error
0 ms0 KiB
#include "islands.h" #include <variant> #include <vector> #include<bits/stdc++.h> using namespace std; int odw[100010]; vector<pair<int, int>>graf[100010]; vector<int>ans; vector<int>stos; void dfs(int x, int kra){ if(graf[x].size()>2){ int pom = graf[x][0].second, pom1 = graf[x][1].second; if(pom/2==kra/2) pom = graf[x][2].second; if(pom1/2==kra/2) pom1 = graf[x][2].second; ans = stos; vector<int>POM = {pom, pom^1, pom1, pom1^1, pom^1, pom, pom1^1, pom1}; for(auto j: POM) ans.push_back(j); while(stos.size()){ ans.push_back(stos.back()^1); stos.pop_back(); } return; } for(auto j: graf[x]){ if(kra/2!=j.second/2){ odw[j.first]++; if(odw[j.first]==1){ stos.push_back(j.second); dfs(j.first, j.second); if(ans.size())return; stos.pop_back(); } } } } std::variant<bool, std::vector<int>> find_journey(int n, int m, std::vector<int> U, std::vector<int> V) { int i; for(i=0;i<m;i+=2){ graf[U[i]].push_back({V[i], i}); graf[V[i]].push_back({U[i], i+1}); } if(graf[0].size()>1 && ans.size()==0){ ans = {};{graf[0][0].second, graf[0][0].second^1, graf[0][1].second, graf[0][1].second^1, graf[0][0].second^1, graf[0][0].second^1^1, graf[0][1].second^1, graf[0][1].second^1^1,}; return ans; } odw[0] = 1; dfs(0, -2); if(ans.size()>0)return ans; 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:49:49: warning: value computed is not used [-Wunused-value]
   49 |   ans = {};{graf[0][0].second, graf[0][0].second^1, graf[0][1].second, graf[0][1].second^1, graf[0][0].second^1, graf[0][0].second^1^1, graf[0][1].second^1, graf[0][1].second^1^1,};
islands.cpp:49:89: warning: value computed is not used [-Wunused-value]
   49 |   ans = {};{graf[0][0].second, graf[0][0].second^1, graf[0][1].second, graf[0][1].second^1, graf[0][0].second^1, graf[0][0].second^1^1, graf[0][1].second^1, graf[0][1].second^1^1,};
islands.cpp:49:110: warning: value computed is not used [-Wunused-value]
   49 |   ans = {};{graf[0][0].second, graf[0][0].second^1, graf[0][1].second, graf[0][1].second^1, graf[0][0].second^1, graf[0][0].second^1^1, graf[0][1].second^1, graf[0][1].second^1^1,};
islands.cpp:49:133: warning: value computed is not used [-Wunused-value]
   49 |   ans = {};{graf[0][0].second, graf[0][0].second^1, graf[0][1].second, graf[0][1].second^1, graf[0][0].second^1, graf[0][0].second^1^1, graf[0][1].second^1, graf[0][1].second^1^1,};
islands.cpp:49:154: warning: value computed is not used [-Wunused-value]
   49 |   ans = {};{graf[0][0].second, graf[0][0].second^1, graf[0][1].second, graf[0][1].second^1, graf[0][0].second^1, graf[0][0].second^1^1, graf[0][1].second^1, graf[0][1].second^1^1,};
islands.cpp:49:180: error: expected primary-expression before '}' token
   49 |   ans = {};{graf[0][0].second, graf[0][0].second^1, graf[0][1].second, graf[0][1].second^1, graf[0][0].second^1, graf[0][0].second^1^1, graf[0][1].second^1, graf[0][1].second^1^1,};
      |                                                                                                                                                                                    ^