제출 #840993

#제출 시각아이디문제언어결과실행 시간메모리
840993Cookie가장 긴 여행 (IOI23_longesttrip)C++17
5 / 100
12 ms336 KiB
#include "longesttrip.h"
#include<bits/stdc++.h>
#include<fstream>

using namespace std;
//ifstream fin("FEEDING.INP");
//ofstream fout("FEEDING.OUT");
#define sz(a) (int)a.size()
#define ll long long
#define pb push_back
#define forr(i, a, b) for(int i = a; i < b; i++)
#define dorr(i, a, b) for(int i = a; i >= b; i--)
#define ld long double
#define vt vector
#include<fstream>
#define fi first
#define se second
#define pll pair<ll, ll>
#define pii pair<int, int>
int n;
std::vector<int> longest_trip(int N, int D)
{
    n = N;
    vt<bool>seen(N);
    vt<int>res;
    int st = 0;
    res.pb(0); seen[0] = 1;
    for(int i = 0; i < n - 1; i++){
        for(int j = 0; j < n; j++){
            if(!seen[j]){
                vt<int>a, b; a.pb(st); b.pb(j);
                if(are_connected(a, b)){
                    res.pb(j); st = j; seen[j] = 1;
                    break;
                }
            }
        }
        
    }
    return(res);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...