답안 #1037872

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1037872 2024-07-29T09:30:17 Z Zicrus 가장 긴 여행 (IOI23_longesttrip) C++17
컴파일 오류
0 ms 0 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 < 100; i++) {
        vector<int> nw = mxRand();
        if (nw.size() > res.size()) res = nw;
    }
    return res;
}

#include "grader.cpp"

Compilation message

longesttrip.cpp:51:10: fatal error: grader.cpp: No such file or directory
   51 | #include "grader.cpp"
      |          ^~~~~~~~~~~~
compilation terminated.