답안 #1037875

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1037875 2024-07-29T09:31:23 Z Zicrus 가장 긴 여행 (IOI23_longesttrip) C++17
40 / 100
932 ms 1664 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 0 ms 344 KB Output is correct
2 Correct 205 ms 1520 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 340 KB Output is correct
2 Correct 23 ms 344 KB Output is correct
3 Correct 155 ms 600 KB Output is correct
4 Correct 404 ms 728 KB Output is correct
5 Correct 921 ms 1080 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 344 KB Output is correct
2 Correct 26 ms 344 KB Output is correct
3 Correct 150 ms 476 KB Output is correct
4 Correct 443 ms 764 KB Output is correct
5 Correct 914 ms 1324 KB Output is correct
6 Correct 8 ms 344 KB Output is correct
7 Correct 23 ms 344 KB Output is correct
8 Correct 174 ms 464 KB Output is correct
9 Correct 326 ms 596 KB Output is correct
10 Correct 905 ms 1080 KB Output is correct
11 Correct 899 ms 1512 KB Output is correct
12 Correct 883 ms 1272 KB Output is correct
13 Correct 904 ms 1264 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 344 KB Output is correct
2 Correct 23 ms 344 KB Output is correct
3 Correct 150 ms 344 KB Output is correct
4 Correct 433 ms 580 KB Output is correct
5 Correct 932 ms 1308 KB Output is correct
6 Correct 9 ms 344 KB Output is correct
7 Correct 27 ms 448 KB Output is correct
8 Correct 170 ms 484 KB Output is correct
9 Correct 319 ms 812 KB Output is correct
10 Correct 854 ms 1024 KB Output is correct
11 Correct 870 ms 1256 KB Output is correct
12 Correct 910 ms 1272 KB Output is correct
13 Correct 863 ms 1116 KB Output is correct
14 Correct 7 ms 344 KB Output is correct
15 Correct 12 ms 344 KB Output is correct
16 Correct 44 ms 344 KB Output is correct
17 Correct 111 ms 344 KB Output is correct
18 Correct 145 ms 592 KB Output is correct
19 Correct 324 ms 592 KB Output is correct
20 Correct 303 ms 600 KB Output is correct
21 Correct 900 ms 1664 KB Output is correct
22 Correct 905 ms 1056 KB Output is correct
23 Correct 917 ms 1260 KB Output is correct
24 Correct 904 ms 1108 KB Output is correct
25 Correct 9 ms 344 KB Output is correct
26 Correct 12 ms 344 KB Output is correct
27 Correct 25 ms 344 KB Output is correct
28 Correct 18 ms 344 KB Output is correct
29 Correct 33 ms 344 KB Output is correct
30 Correct 213 ms 600 KB Output is correct
31 Correct 210 ms 856 KB Output is correct
32 Correct 216 ms 600 KB Output is correct
33 Correct 331 ms 344 KB Output is correct
34 Correct 335 ms 736 KB Output is correct
35 Correct 330 ms 744 KB Output is correct
36 Correct 872 ms 1528 KB Output is correct
37 Correct 914 ms 1304 KB Output is correct
38 Correct 860 ms 1104 KB Output is correct
39 Correct 838 ms 1076 KB Output is correct
40 Correct 803 ms 1320 KB Output is correct
41 Correct 822 ms 896 KB Output is correct
42 Correct 799 ms 1080 KB Output is correct
43 Correct 781 ms 1220 KB Output is correct
44 Correct 814 ms 1160 KB Output is correct
45 Correct 11 ms 344 KB Output is correct
46 Correct 13 ms 344 KB Output is correct
47 Correct 21 ms 344 KB Output is correct
48 Correct 21 ms 344 KB Output is correct
49 Correct 18 ms 344 KB Output is correct
50 Correct 207 ms 480 KB Output is correct
51 Correct 200 ms 592 KB Output is correct
52 Correct 204 ms 448 KB Output is correct
53 Correct 347 ms 796 KB Output is correct
54 Correct 315 ms 872 KB Output is correct
55 Correct 310 ms 544 KB Output is correct
56 Correct 906 ms 1236 KB Output is correct
57 Correct 875 ms 1128 KB Output is correct
58 Correct 901 ms 1032 KB Output is correct
59 Correct 810 ms 1256 KB Output is correct
60 Correct 821 ms 1300 KB Output is correct
61 Correct 818 ms 968 KB Output is correct
62 Correct 845 ms 1132 KB Output is correct
63 Correct 816 ms 1112 KB Output is correct
64 Correct 857 ms 1288 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 344 KB Output is correct
2 Correct 30 ms 344 KB Output is correct
3 Partially correct 142 ms 460 KB Output is partially correct
4 Partially correct 444 ms 580 KB Output is partially correct
5 Partially correct 886 ms 1132 KB Output is partially correct
6 Correct 8 ms 344 KB Output is correct
7 Correct 30 ms 344 KB Output is correct
8 Partially correct 153 ms 344 KB Output is partially correct
9 Partially correct 357 ms 708 KB Output is partially correct
10 Partially correct 924 ms 1268 KB Output is partially correct
11 Partially correct 873 ms 1264 KB Output is partially correct
12 Partially correct 925 ms 1120 KB Output is partially correct
13 Partially correct 901 ms 1512 KB Output is partially correct
14 Correct 12 ms 344 KB Output is correct
15 Correct 10 ms 344 KB Output is correct
16 Correct 45 ms 344 KB Output is correct
17 Partially correct 95 ms 460 KB Output is partially correct
18 Partially correct 182 ms 1192 KB Output is partially correct
19 Partially correct 345 ms 592 KB Output is partially correct
20 Partially correct 361 ms 708 KB Output is partially correct
21 Correct 9 ms 344 KB Output is correct
22 Correct 10 ms 344 KB Output is correct
23 Correct 24 ms 344 KB Output is correct
24 Correct 25 ms 344 KB Output is correct
25 Correct 28 ms 344 KB Output is correct
26 Partially correct 188 ms 484 KB Output is partially correct
27 Partially correct 192 ms 592 KB Output is partially correct
28 Partially correct 221 ms 712 KB Output is partially correct
29 Partially correct 367 ms 728 KB Output is partially correct
30 Partially correct 339 ms 544 KB Output is partially correct
31 Partially correct 331 ms 600 KB Output is partially correct
32 Correct 9 ms 344 KB Output is correct
33 Correct 10 ms 344 KB Output is correct
34 Correct 20 ms 344 KB Output is correct
35 Correct 19 ms 344 KB Output is correct
36 Correct 26 ms 344 KB Output is correct
37 Incorrect 67 ms 592 KB Incorrect
38 Halted 0 ms 0 KB -