Submission #991748

# Submission time Handle Problem Language Result Execution time Memory
991748 2024-06-03T05:10:34 Z stdfloat Longest Trip (IOI23_longesttrip) C++17
0 / 100
1000 ms 344 KB
#include "bits/stdc++.h"
#include "longesttrip.h"
using namespace std;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); //mt19937_64 for ll

int rnd(int l, int r) {
    return l + rng() % (r - l + 1);
}

vector<int> longest_trip(int n, int D) {
    vector<int> v = {0};
    vector<bool> vis(n, false); vis[0] = true;
    while ((int)v.size() < n) {
        vector<bool> vis2 = vis;
        while (true) {
            int x = rnd(1, n - 1);
            while (!vis2[x]) x = rnd(1, n - 1);

            if (are_connected({v.back()}, {x})) {
                vis[x] = true;
                v.push_back(x);

                break;
            }

            vis2[x] = true;
        }
    }

    return v;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 3047 ms 344 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3040 ms 344 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3021 ms 344 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3046 ms 344 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3061 ms 344 KB Time limit exceeded
2 Halted 0 ms 0 KB -