Submission #939830

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
9398302024-03-06 19:35:41jamjanekLongest Trip (IOI23_longesttrip)C++17
100 / 100
14 ms1052 KiB
#include "longesttrip.h"
#include<bits/stdc++.h>
using namespace std;
bool czy[300];
vector<int>polacz(vector<int>a, vector<int>b){
while(b.size()){
a.push_back(b.back());
b.pop_back();
}
return a;
}
vector<int>prefix(vector<int>A, int ile){
while((int)A.size()>ile)A.pop_back();
return A;
}
vector<int> longest_trip(int n, int d)
{
int i;
vector<int>tab[2];tab[0].push_back(0);tab[1].push_back(1);
for(i=1;i<n/2;i++){
int a = i*2, b = i*2+1;
if(are_connected({a}, {b})){
if(are_connected({a}, {tab[0].back()})){
tab[0].push_back(a);
tab[0].push_back(b);
}
else if(are_connected({a}, {tab[1].back()})){
tab[1].push_back(a);
tab[1].push_back(b);
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#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...