Submission #841736

# Submission time Handle Problem Language Result Execution time Memory
841736 2023-09-02T01:41:03 Z anhduc2701 Longest Trip (IOI23_longesttrip) C++17
15 / 100
7 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(2);
				K.pb(1);
			}
			while((int)(K.size())<N){
				int i=(int)(K.size());
				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:40:2: warning: control reaches end of non-void function [-Wreturn-type]
   40 |  }
      |  ^
# Verdict Execution time Memory Grader output
1 Incorrect 1 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 0 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 Correct 7 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 4 ms 344 KB Output is correct
5 Correct 6 ms 344 KB Output is correct
6 Correct 4 ms 344 KB Output is correct
7 Correct 4 ms 344 KB Output is correct
8 Correct 4 ms 344 KB Output is correct
9 Correct 4 ms 344 KB Output is correct
10 Correct 4 ms 344 KB Output is correct
11 Correct 4 ms 344 KB Output is correct
12 Correct 5 ms 344 KB Output is correct
13 Correct 5 ms 600 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 4 ms 544 KB Output is correct
4 Correct 4 ms 344 KB Output is correct
5 Correct 4 ms 344 KB Output is correct
6 Correct 4 ms 344 KB Output is correct
7 Correct 4 ms 496 KB Output is correct
8 Correct 4 ms 344 KB Output is correct
9 Correct 4 ms 344 KB Output is correct
10 Correct 4 ms 600 KB Output is correct
11 Correct 4 ms 344 KB Output is correct
12 Correct 4 ms 344 KB Output is correct
13 Correct 4 ms 600 KB Output is correct
14 Incorrect 1 ms 344 KB Incorrect
15 Halted 0 ms 0 KB -
# 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 4 ms 344 KB Output is correct
4 Correct 4 ms 344 KB Output is correct
5 Correct 4 ms 344 KB Output is correct
6 Correct 4 ms 344 KB Output is correct
7 Correct 4 ms 344 KB Output is correct
8 Correct 4 ms 344 KB Output is correct
9 Correct 4 ms 344 KB Output is correct
10 Correct 4 ms 344 KB Output is correct
11 Correct 5 ms 440 KB Output is correct
12 Correct 4 ms 344 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 -