Submission #963453

#TimeUsernameProblemLanguageResultExecution timeMemory
963453NamkhingThousands Islands (IOI22_islands)C++17
6.75 / 100
25 ms4436 KiB
#include <bits/stdc++.h> #include "islands.h" using namespace std; variant<bool, vector<int>> find_journey(int N, int M, vector<int> U, vector<int> V) { int first = 0, second = 0; for (int u : U) { if (u) { second++; } else { first++; } } if (first < 2 || second < 1) { return false; } int a, b, c; for (int i = 0; i < M; i++) { if (!U[i]) { a = i; break; } } for (int i = M - 1; i >= 0; i--) { if (!U[i]) { b = i; break; } } for (int i = 0; i < M; i++) { if (U[i]) { c = i; break; } } vector<int> r = {a, c, b, a, c, b}; return r; }

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:44:38: warning: 'b' may be used uninitialized in this function [-Wmaybe-uninitialized]
   44 |     vector<int> r = {a, c, b, a, c, b};
      |                                      ^
islands.cpp:44:38: warning: 'a' may be used uninitialized in this function [-Wmaybe-uninitialized]
islands.cpp:44:38: warning: 'c' 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...