Submission #937254

# Submission time Handle Problem Language Result Execution time Memory
937254 2024-03-03T17:07:26 Z Dan4Life Longest Trip (IOI23_longesttrip) C++17
15 / 100
7 ms 1012 KB
#include "longesttrip.h"
#include <bits/stdc++.h>
using namespace std;

#define pf push_front
#define pb push_back
#define sz(a) (int)a.size()
#define all(a) begin(a),end(a)

bool edge(int i, int j){
	return are_connected({i},{j});
}

vector<int> longest_trip(int N, int D)
{
	vector<int> v; deque<int> dq;
	v.clear(); dq.clear(); 
	dq.pb(0); int i = 1;
	while(sz(dq)<N){
		if(i==1){
			if(edge(0,1)){
				dq.pb(1);
				if(edge(1,2)) dq.pb(2);
				else dq.pf(2);
			}
			else{
				dq.pb(2); dq.pb(1);
			}
			i = 3;
		}
		else{
			if(edge(dq.back(),i)) dq.pb(i);
			else dq.pf(i);
			i++;
		}
	}
	for(auto u : dq) v.pb(u);
    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 6 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 600 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 4 ms 344 KB Output is correct
4 Correct 5 ms 344 KB Output is correct
5 Correct 4 ms 600 KB Output is correct
6 Correct 5 ms 344 KB Output is correct
7 Correct 6 ms 344 KB Output is correct
8 Correct 5 ms 344 KB Output is correct
9 Correct 4 ms 600 KB Output is correct
10 Correct 5 ms 344 KB Output is correct
11 Correct 5 ms 340 KB Output is correct
12 Correct 4 ms 344 KB Output is correct
13 Correct 5 ms 436 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 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 600 KB Output is correct
5 Correct 5 ms 796 KB Output is correct
6 Correct 5 ms 344 KB Output is correct
7 Correct 6 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 344 KB Output is correct
12 Correct 4 ms 344 KB Output is correct
13 Correct 5 ms 436 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 6 ms 344 KB Output is correct
2 Correct 5 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 5 ms 1012 KB Output is correct
10 Correct 5 ms 600 KB Output is correct
11 Correct 5 ms 600 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 -