Submission #1236888

#TimeUsernameProblemLanguageResultExecution timeMemory
1236888countlessThousands Islands (IOI22_islands)C++20
1.75 / 100
21 ms7360 KiB
#include "islands.h"
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;

#define sp <<" "<<
#define endl "\n"

variant<bool, vector<int>> find_journey(int N, int M, vector<int> U, vector<int> V) {
    vector<vector<pair<int, int>>> adj(N), rev(N);
    int a, b, c, d, e, f;
    for (int i = 0; i < M; i++) {
        adj[U[i]].emplace_back(V[i], i);
        rev[V[i]].emplace_back(U[i], i);

        if (U[i] == 0 and V[i] == 1) a = i;
        if (U[i] == 1 and V[i] == 0) b = i;
        if (U[i] == 1 and V[i] == 2) c = i;
        if (U[i] == 2 and V[i] == 1) d = i;
        if (U[i] == 0 and V[i] == 2) e = i;
        if (U[i] == 2 and V[i] == 0) f = i;
    }

    vector<int> ans;
    if (N > 2) {
        ans = {a, c, e, f, d, b, e, c, a, b, d, f};
    } else {
        return false;
    }

    return ans;
}
#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...