Submission #1024699

#TimeUsernameProblemLanguageResultExecution timeMemory
1024699Wansur수천개의 섬 (IOI22_islands)C++17
12.35 / 100
80 ms26300 KiB
#include <bits/stdc++.h> #include <variant> #define f first #define s second #define ent '\n' using namespace std; typedef long long ll; const int maxn = 2e5 + 12; const int mod = 1e9 + 2022; map<int, int> a[maxn]; vector<int> g[maxn]; int n, m; 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++){ a[u[i]][v[i]] = i; g[u[i]].push_back(i); } vector<int> ans; if(g[0].size() >= 2){ int x = v[g[0][0]], y = v[g[0][1]]; ans = {a[0][x], a[x][0], a[0][y], a[y][0], a[x][0], a[0][x], a[y][0], a[0][y]}; return ans; } if(g[0].size() == 0) return false; int x = v[g[0][0]], sz = 1, y = 0; ans = {g[0][0]}; while(g[x].size() == 2){ int t = 0; if(v[g[x][t]] == y){ t++; } ans.push_back(g[x][t]); y = x; x = v[g[x][t]]; } if(g[x].size() <= 1) return false; return ans; }

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:29:25: warning: unused variable 'sz' [-Wunused-variable]
   29 |     int x = v[g[0][0]], sz = 1, y = 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...