# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
856911 | IS_Rushdi | Longest Trip (IOI23_longesttrip) | C++17 | 42 ms | 1476 KiB |
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;
#include "longesttrip.h"
vector<int> longest_trip(int n, int k)
{
vector<int>ans;
if(k == 3) for(int i = 0; i < n; i++) ans.push_back(i);
else if(k == 2){
int v = 0; ans.push_back(0);
vector<int>a;
for(int i = 1; i < n; i++) a.push_back(i);
for(int i = 1; i < n; i++){
vector<int>wow; wow.push_back(v);
vector<int>arr = a;
while(arr.size() > 1){
int m = arr.size()/2;
vector<int>newarr;
for(int j = 0; j < m; j++) newarr.push_back(arr[j]);
bool ok = are_connected(wow,newarr);
if(ok){
arr = newarr;
}else{
vector<int>newarr2;
for(int j = m; j < arr.size(); j++) newarr2.push_back(arr[j]);
arr = newarr2;
}
}
vector<int>A;
for(int i = 0; i < a.size(); i++){
if(a[i] == arr[0]) continue;
A.push_back(a[i]);
}
a = A;
v = arr[0];
ans.push_back(v);
}
}
return ans;
}
// int main(){
// }
Compilation message (stderr)
# | 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... |