Submission #963456

#TimeUsernameProblemLanguageResultExecution timeMemory
963456NamkhingThousands Islands (IOI22_islands)C++17
5 / 100
23 ms3132 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) {
    if (N == 2) {
        return false;
    }

    int a, b, c, d;

    for (int i = 0; i < M; i++) {
        if (U[i] == 0 && V[i] == 1) {
            a = i;
            break;
        }
    }

    for (int i = 0; i < M; i++) {
        if (U[i] == 1 && V[i] == 0) {
            b = i;
            break;
        }
    }

    for (int i = 0; i < M; i++) {
        if (U[i] == 0 && V[i] == 2) {
            c = i;
            break;
        }
    }

    for (int i = 0; i < M; i++) {
        if (U[i] == 2 && V[i] == 0) {
            d = i;
            break;
        }
    }

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