Submission #1236885

#TimeUsernameProblemLanguageResultExecution timeMemory
1236885countlessThousands Islands (IOI22_islands)C++20
5 / 100
21 ms6720 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);
    for (int i = 0; i < M; i++) {
        adj[U[i]].emplace_back(V[i], i);
        rev[V[i]].emplace_back(U[i], i);
    }

    assert(N == 2);

    int a, b, c;
    vector<int> ans;
    if (adj[0].size() >= 2 and adj[1].size() >= 1) {
        a = adj[0][0].second;
        b = adj[0][1].second;
        c = adj[1][0].second;

        ans = {a, c, b, a, c, b};
    } 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...