Submission #825682

#TimeUsernameProblemLanguageResultExecution timeMemory
825682PixelCatThousands Islands (IOI22_islands)C++17
6.75 / 100
35 ms4420 KiB
#include "islands.h"

#ifdef NYAOWO
#include "grader.cpp"
#endif

#include <bits/stdc++.h>
#define For(i, a, b) for(int i = a; i <= b; i++)
#define Forr(i, a, b) for(int i = a; i >= b; i--)
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define sz(x) ((int)x.size())
#define eb emplace_back
// #define int LL
using namespace std;
using i32 = int32_t;
using LL = long long;
using pii = pair<int, int>;

variant<bool, vector<int>> find_journey(int N, int M, vector<int> U, vector<int> V) {
    // if (N == 4) {
    //   return vector<int>({0, 1, 2, 4, 0, 3, 2, 1, 4, 3});
    // }
    // return false;
    if(N == 2) {
        vector<int> e0, e1;
        For(i, 0, M - 1) {
            if(U[i] == 0) e0.eb(i);
            else e1.eb(i);
        }
        if(sz(e0) >= 2 && sz(e1) >= 1) {
            int a = e0[0], b = e0[1];
            int c = e1[0];
            return vector<int>({b, c, a, b, c, a});
        }
        return false;
    }

    int id[3][3] = {-1};
    For(i, 0, M - 1) {
        int x = U[i];
        int y = V[i];
        if(x < 3 && y < 3) {
            id[x][y] = i;
        }
    }
    vector<int> owo = {0, 1, 2, 0, 2, 1, 0, 2, 1, 0, 1, 2};
    vector<int> res;
    For(i, 1, sz(owo) - 1) {
        res.eb(id[owo[i - 1]][owo[i]]);
    }
    return res;
}

/*

4 5
0 1
1 2
2 3
0 3
3 1

1
10
0 1 2 4 0 3 2 1 4 3


2 3
0 1
1 0
1 0

0
0

*/
#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...