# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
848231 | bachhoangxuan | 가장 긴 여행 (IOI23_longesttrip) | C++17 | 11 ms | 1236 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "longesttrip.h"
#include <bits/stdc++.h>
using namespace std;
mt19937_64 rng;
const int maxn=305;
vector<int> cc[maxn];
vector<int> longest_trip(int N, int D)
{
rng.seed(998244353);
for(int i=0;i<N;i++) cc[i].clear();
vector<int> res={0};
vector<int> s;
for(int i=1;i<N;i++){
cc[i].push_back(i);
s.push_back(i);
}
while(!s.empty()){
int st=-1,cnt=0;
bool check=false;
shuffle(s.begin(),s.end(),rng);
for(int x:s){
cnt++;
if(!are_connected({res.back()},cc[x])){
if(st==-1) st=x;
else for(int u:cc[x]) cc[st].push_back(u);
}
else{
check=true;
int l=1,r=(int)cc[x].size();
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |