Submission #1065175

# Submission time Handle Problem Language Result Execution time Memory
1065175 2024-08-19T02:36:34 Z pcc Longest Trip (IOI23_longesttrip) C++17
15 / 100
8 ms 600 KB
#include "longesttrip.h"
#include <bits/stdc++.h>
using namespace std;

#define vi vector<int>

int ask(vector<int> a,vector<int> b){
	return are_connected(a,b);
}

int ask(int a,int b){
	return ask(vector<int>({a}),vector<int>({b}));
}

std::vector<int> longest_trip(int N, int D){
	deque<int> ans;
	if(!ask(0,1)){
		ans = {0,2,1};
	}
	else if(!ask(0,2)){
		ans = {0,1,2};
	}
	else{
		ans = {2,0,1};
	}
	for(int i = 3;i<N;i++){
		if(ask(i,ans.front())){
			ans.push_front(i);
		}
		else{
			ans.push_back(i);
		}
	}
	vi v;
	for(auto &i:ans)v.push_back(i);
	return v;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 344 KB Output is correct
2 Correct 5 ms 344 KB Output is correct
3 Correct 5 ms 344 KB Output is correct
4 Correct 5 ms 344 KB Output is correct
5 Correct 6 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 344 KB Output is correct
2 Correct 5 ms 344 KB Output is correct
3 Correct 5 ms 344 KB Output is correct
4 Correct 7 ms 344 KB Output is correct
5 Correct 5 ms 600 KB Output is correct
6 Correct 5 ms 344 KB Output is correct
7 Correct 5 ms 344 KB Output is correct
8 Correct 5 ms 344 KB Output is correct
9 Correct 7 ms 344 KB Output is correct
10 Correct 7 ms 344 KB Output is correct
11 Correct 5 ms 344 KB Output is correct
12 Correct 5 ms 344 KB Output is correct
13 Correct 5 ms 432 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 344 KB Output is correct
2 Correct 4 ms 344 KB Output is correct
3 Correct 5 ms 344 KB Output is correct
4 Correct 5 ms 344 KB Output is correct
5 Correct 5 ms 436 KB Output is correct
6 Correct 4 ms 344 KB Output is correct
7 Correct 7 ms 344 KB Output is correct
8 Correct 7 ms 344 KB Output is correct
9 Correct 7 ms 340 KB Output is correct
10 Correct 4 ms 344 KB Output is correct
11 Correct 7 ms 344 KB Output is correct
12 Correct 5 ms 440 KB Output is correct
13 Correct 7 ms 344 KB Output is correct
14 Incorrect 0 ms 344 KB Incorrect
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 344 KB Output is correct
2 Correct 5 ms 344 KB Output is correct
3 Correct 7 ms 344 KB Output is correct
4 Correct 4 ms 344 KB Output is correct
5 Correct 6 ms 344 KB Output is correct
6 Correct 5 ms 344 KB Output is correct
7 Correct 5 ms 344 KB Output is correct
8 Correct 5 ms 344 KB Output is correct
9 Correct 6 ms 344 KB Output is correct
10 Correct 5 ms 344 KB Output is correct
11 Correct 6 ms 344 KB Output is correct
12 Correct 8 ms 432 KB Output is correct
13 Correct 4 ms 344 KB Output is correct
14 Incorrect 0 ms 344 KB Incorrect
15 Halted 0 ms 0 KB -