Submission #841733

# Submission time Handle Problem Language Result Execution time Memory
841733 2023-09-02T01:39:05 Z anhduc2701 Longest Trip (IOI23_longesttrip) C++17
5 / 100
5 ms 600 KB
#include<bits/stdc++.h>
#include "longesttrip.h"
#define pb push_back
#define fi first
#define se second 
using namespace std;
typedef long long ll;
int n;
vector<int> longest_trip(int N,int D){
	n=N;
	if(D==3){
		vector<int>K;
		for(int i=0;i<N;i++){
			K.pb(i);
		}
		return K;
	}
	else if(D==2){
		vector<int>K;
		if(are_connected(vector<int>(1,0),vector<int>(1,1))){
			K.pb(0);
			K.pb(1);
		}
		else{
			K.pb(0);
			K.pb(1);
			K.pb(2);
		}
		for(int i=3;i<N;i++){
			if(are_connected(vector<int>(1,K[0]),vector<int>(1,i))){
				K.insert(K.begin(),i);
			}
			else{
				K.pb(i);
			}
		}
		return K;
	}
}

Compilation message

longesttrip.cpp: In function 'std::vector<int> longest_trip(int, int)':
longesttrip.cpp:39:1: warning: control reaches end of non-void function [-Wreturn-type]
   39 | }
      | ^
# 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 2 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
# 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 3 ms 344 KB Output is correct
2 Correct 4 ms 344 KB Output is correct
3 Correct 4 ms 344 KB Output is correct
4 Correct 5 ms 344 KB Output is correct
5 Correct 5 ms 600 KB Output is correct
6 Incorrect 0 ms 596 KB Incorrect
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Incorrect
2 Halted 0 ms 0 KB -