Submission #632177

#TimeUsernameProblemLanguageResultExecution timeMemory
632177Minindu2006Thousands Islands (IOI22_islands)C++17
10 / 100
32 ms5068 KiB
#include "islands.h" #include<bits/stdc++.h> #include <variant> #include <vector> using namespace std; int n, m; vector<int> u, v; std::variant<bool, std::vector<int>> find_journey(int N, int M, std::vector<int> U, std::vector<int> V) { n = N, m = M; u = U, v = V; vector<int> ans; if(n <= 2) { if(m <= 2) return false; int z = 0; vector<int> cur(3); for(int i=0;i<m;i++) { if(u[i] == 0) { if(z < 2) cur[z] = i; z++; } else cur[2] = i; } if(z < 2 || z == m) return false; ans.resize(3); ans[0] = cur[0]; ans[1] = cur[2]; ans[2] = cur[1]; for(int i=0;i<3;i++) ans.push_back(ans[i]); return ans; } int a, b, c, d; for(int i=0;i<m;i++) { if(u[i] == 0 && v[i] == 1) a = i; if(u[i] == 1 && v[i] == 0) b = i; if(u[i] == 0 && v[i] == 2) c = i; if(u[i] == 2 && v[i] == 0) d = i; } return vector<int> ({a, b, c, d, b, a, d, c}); }

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:52:47: warning: 'd' may be used uninitialized in this function [-Wmaybe-uninitialized]
   52 |   return vector<int> ({a, b, c, d, b, a, d, c});
      |                                               ^
islands.cpp:52:47: warning: 'c' may be used uninitialized in this function [-Wmaybe-uninitialized]
islands.cpp:52:47: warning: 'b' may be used uninitialized in this function [-Wmaybe-uninitialized]
islands.cpp:52:47: warning: 'a' may be used uninitialized in this function [-Wmaybe-uninitialized]
#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...