Submission #980144

# Submission time Handle Problem Language Result Execution time Memory
980144 2024-05-12T00:12:49 Z vjudge1 Longest Trip (IOI23_longesttrip) C++17
15 / 100
779 ms 656 KB
#include "longesttrip.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector <ll>;
using dll = deque <ll>;
using vi = vector <int>;

const ll MAXN = 256+16;
bool mat[MAXN][MAXN];

vi longest_trip (int n, int d) {
    for (ll u = 0; u < n; u++) {
        mat[u][u] = false;
        for (ll v = u+1; v < n; v++) {
            if (are_connected(vi({ int(u) }), vi({ int(v) }))) {
                mat[u][v] = true;
                mat[v][u] = true;
            } else {
                mat[u][v] = false;
                mat[v][u] = false;
            }
        }
    }
    dll dq;
    dq.push_back(0);
    vector <char> vis(n, false);
    vis[0] = true;
    for (ll v = 0; v < n; v++) {
        if (mat[0][v]) {
            vis[v] = true;
            dq.push_back(v);
            break;
        }
    }
    for (ll u = 0; u < n; u++) {
        if (vis[u]) continue;
        vis[u] = true;
        if (mat[u][dq.front()]) {
            dq.push_front(u);
        } else {
            dq.push_back(u);
        }
    }
    vi ans(dq.begin(), dq.end());
    return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 344 KB Output is correct
2 Correct 19 ms 344 KB Output is correct
3 Correct 125 ms 344 KB Output is correct
4 Correct 347 ms 592 KB Output is correct
5 Correct 734 ms 484 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 340 KB Output is correct
2 Correct 31 ms 344 KB Output is correct
3 Correct 115 ms 344 KB Output is correct
4 Correct 356 ms 448 KB Output is correct
5 Correct 735 ms 488 KB Output is correct
6 Correct 6 ms 344 KB Output is correct
7 Correct 25 ms 344 KB Output is correct
8 Correct 127 ms 344 KB Output is correct
9 Correct 266 ms 592 KB Output is correct
10 Correct 700 ms 484 KB Output is correct
11 Correct 721 ms 600 KB Output is correct
12 Correct 711 ms 484 KB Output is correct
13 Correct 761 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 344 KB Output is correct
2 Correct 24 ms 344 KB Output is correct
3 Correct 129 ms 600 KB Output is correct
4 Correct 361 ms 452 KB Output is correct
5 Correct 715 ms 484 KB Output is correct
6 Correct 6 ms 344 KB Output is correct
7 Correct 24 ms 344 KB Output is correct
8 Correct 132 ms 344 KB Output is correct
9 Correct 258 ms 616 KB Output is correct
10 Correct 696 ms 656 KB Output is correct
11 Correct 707 ms 600 KB Output is correct
12 Correct 751 ms 488 KB Output is correct
13 Correct 710 ms 488 KB Output is correct
14 Incorrect 0 ms 340 KB Incorrect
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 344 KB Output is correct
2 Correct 21 ms 340 KB Output is correct
3 Partially correct 124 ms 344 KB Output is partially correct
4 Partially correct 335 ms 592 KB Output is partially correct
5 Partially correct 778 ms 488 KB Output is partially correct
6 Correct 6 ms 344 KB Output is correct
7 Correct 21 ms 344 KB Output is correct
8 Partially correct 115 ms 344 KB Output is partially correct
9 Partially correct 281 ms 344 KB Output is partially correct
10 Partially correct 779 ms 488 KB Output is partially correct
11 Partially correct 760 ms 480 KB Output is partially correct
12 Partially correct 714 ms 480 KB Output is partially correct
13 Partially correct 687 ms 480 KB Output is partially correct
14 Incorrect 1 ms 344 KB Incorrect
15 Halted 0 ms 0 KB -