This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define vi vector<int>
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define MAX 500005
#define F first
#define S second
std::vector<int> longest_trip(int N, int D);
bool are_connected(std::vector<int> A, std::vector<int> B);
ll pass[MAX];
std::vector<int> longest_trip(int N, int D)
{
if(D==3){
std::vector<int> r={};
for(int i=0;i<N;i++)r.push_back(i);
return r;
}
vi r={0};ll f=1;
for(int i=1;i<N;i++){
if(pass[i]==1)continue;
if(f==i)f++;
ll h=are_connected({r.back()},{i});
if(h==0){
r.push_back(f);
pass[f]=1;
f++;
}
r.push_back(i);
}
return r;
}
# | 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... |