답안 #1037877

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1037877 2024-07-29T09:33:37 Z Zicrus 가장 긴 여행 (IOI23_longesttrip) C++17
40 / 100
948 ms 1628 KB
#include <bits/stdc++.h>
#include "longesttrip.h"
using namespace std;

typedef long long ll;

vector<vector<ll>> adj;
vector<bool> vst;
mt19937 mt;

vector<int> mxRand() {
    ll n = adj.size();
    ll start = mt() % n;
    ll cur = start;
    vector<int> res = {(int)start};
loop:
    vst[cur] = true;
    shuffle(adj[cur].begin(), adj[cur].end(), mt);
    for (auto &e : adj[cur]) {
        if (!vst[e]) {
            cur = e;
            res.push_back(e);
            goto loop;
        }
    }
    for (auto &e : res) vst[e] = false;
    return res;
}

vector<int> longest_trip(int n, int d) {
    mt = mt19937(time(0));
    adj = vector<vector<ll>>(n);
    vst = vector<bool>(n);
    for (int i = 0; i < n; i++) {
        for (int j = i+1; j < n; j++) {
            if (are_connected({i}, {j})) {
                adj[i].push_back(j);
                adj[j].push_back(i);
            }
        }
    }

    vector<int> res;
    for (int i = 0; i < 50; i++) {
        vector<int> nw = mxRand();
        if (nw.size() > res.size()) res = nw;
    }
    return res;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 222 ms 1340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 344 KB Output is correct
2 Correct 30 ms 344 KB Output is correct
3 Correct 171 ms 680 KB Output is correct
4 Correct 438 ms 584 KB Output is correct
5 Correct 869 ms 1060 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 344 KB Output is correct
2 Correct 26 ms 344 KB Output is correct
3 Correct 174 ms 344 KB Output is correct
4 Correct 428 ms 604 KB Output is correct
5 Correct 914 ms 1424 KB Output is correct
6 Correct 10 ms 344 KB Output is correct
7 Correct 25 ms 344 KB Output is correct
8 Correct 152 ms 452 KB Output is correct
9 Correct 329 ms 560 KB Output is correct
10 Correct 948 ms 1280 KB Output is correct
11 Correct 939 ms 1340 KB Output is correct
12 Correct 904 ms 1308 KB Output is correct
13 Correct 921 ms 1024 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 344 KB Output is correct
2 Correct 32 ms 344 KB Output is correct
3 Correct 156 ms 600 KB Output is correct
4 Correct 451 ms 580 KB Output is correct
5 Correct 947 ms 1192 KB Output is correct
6 Correct 8 ms 344 KB Output is correct
7 Correct 28 ms 344 KB Output is correct
8 Correct 180 ms 476 KB Output is correct
9 Correct 312 ms 808 KB Output is correct
10 Correct 902 ms 1236 KB Output is correct
11 Correct 888 ms 1264 KB Output is correct
12 Correct 892 ms 1256 KB Output is correct
13 Correct 884 ms 1308 KB Output is correct
14 Correct 8 ms 344 KB Output is correct
15 Correct 15 ms 344 KB Output is correct
16 Correct 43 ms 344 KB Output is correct
17 Correct 109 ms 452 KB Output is correct
18 Correct 158 ms 712 KB Output is correct
19 Correct 349 ms 676 KB Output is correct
20 Correct 330 ms 1012 KB Output is correct
21 Correct 905 ms 1300 KB Output is correct
22 Correct 877 ms 1480 KB Output is correct
23 Correct 885 ms 1628 KB Output is correct
24 Correct 899 ms 1232 KB Output is correct
25 Correct 10 ms 344 KB Output is correct
26 Correct 9 ms 344 KB Output is correct
27 Correct 27 ms 344 KB Output is correct
28 Correct 35 ms 596 KB Output is correct
29 Correct 25 ms 344 KB Output is correct
30 Correct 199 ms 476 KB Output is correct
31 Correct 203 ms 600 KB Output is correct
32 Correct 182 ms 688 KB Output is correct
33 Correct 342 ms 988 KB Output is correct
34 Correct 346 ms 600 KB Output is correct
35 Correct 293 ms 736 KB Output is correct
36 Correct 905 ms 1236 KB Output is correct
37 Correct 890 ms 1036 KB Output is correct
38 Correct 813 ms 924 KB Output is correct
39 Correct 811 ms 1336 KB Output is correct
40 Correct 811 ms 1420 KB Output is correct
41 Correct 793 ms 972 KB Output is correct
42 Correct 818 ms 1072 KB Output is correct
43 Correct 791 ms 1552 KB Output is correct
44 Correct 823 ms 980 KB Output is correct
45 Correct 13 ms 596 KB Output is correct
46 Correct 9 ms 344 KB Output is correct
47 Correct 28 ms 344 KB Output is correct
48 Correct 24 ms 344 KB Output is correct
49 Correct 33 ms 344 KB Output is correct
50 Correct 197 ms 468 KB Output is correct
51 Correct 176 ms 344 KB Output is correct
52 Correct 212 ms 472 KB Output is correct
53 Correct 339 ms 596 KB Output is correct
54 Correct 327 ms 792 KB Output is correct
55 Correct 322 ms 540 KB Output is correct
56 Correct 891 ms 1044 KB Output is correct
57 Correct 870 ms 976 KB Output is correct
58 Correct 865 ms 1136 KB Output is correct
59 Correct 831 ms 1152 KB Output is correct
60 Correct 884 ms 1204 KB Output is correct
61 Correct 861 ms 1144 KB Output is correct
62 Correct 848 ms 848 KB Output is correct
63 Correct 833 ms 1244 KB Output is correct
64 Correct 866 ms 1300 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 344 KB Output is correct
2 Correct 26 ms 344 KB Output is correct
3 Partially correct 156 ms 480 KB Output is partially correct
4 Partially correct 449 ms 792 KB Output is partially correct
5 Partially correct 896 ms 1060 KB Output is partially correct
6 Correct 7 ms 344 KB Output is correct
7 Correct 25 ms 344 KB Output is correct
8 Partially correct 180 ms 724 KB Output is partially correct
9 Partially correct 343 ms 592 KB Output is partially correct
10 Partially correct 912 ms 1104 KB Output is partially correct
11 Partially correct 901 ms 1260 KB Output is partially correct
12 Partially correct 861 ms 1364 KB Output is partially correct
13 Partially correct 907 ms 1232 KB Output is partially correct
14 Correct 8 ms 344 KB Output is correct
15 Correct 13 ms 344 KB Output is correct
16 Correct 39 ms 344 KB Output is correct
17 Partially correct 125 ms 344 KB Output is partially correct
18 Partially correct 140 ms 344 KB Output is partially correct
19 Partially correct 338 ms 708 KB Output is partially correct
20 Partially correct 341 ms 592 KB Output is partially correct
21 Correct 8 ms 344 KB Output is correct
22 Correct 10 ms 344 KB Output is correct
23 Correct 30 ms 344 KB Output is correct
24 Correct 22 ms 344 KB Output is correct
25 Correct 22 ms 344 KB Output is correct
26 Partially correct 216 ms 476 KB Output is partially correct
27 Partially correct 194 ms 468 KB Output is partially correct
28 Partially correct 200 ms 600 KB Output is partially correct
29 Partially correct 357 ms 592 KB Output is partially correct
30 Partially correct 310 ms 548 KB Output is partially correct
31 Partially correct 366 ms 540 KB Output is partially correct
32 Correct 11 ms 344 KB Output is correct
33 Correct 11 ms 344 KB Output is correct
34 Correct 22 ms 344 KB Output is correct
35 Correct 24 ms 344 KB Output is correct
36 Correct 19 ms 344 KB Output is correct
37 Incorrect 29 ms 452 KB Incorrect
38 Halted 0 ms 0 KB -