Submission #1063976

# Submission time Handle Problem Language Result Execution time Memory
1063976 2024-08-18T07:18:41 Z AmirAli_H1 Longest Trip (IOI23_longesttrip) C++17
0 / 100
1 ms 344 KB
// In the name of Allah

#include <bits/stdc++.h>
#include "longesttrip.h"
using namespace std;

typedef			long long				ll;
typedef			pair<int, int>			pii;
typedef			pair<ll, ll>			pll;

#define			F						first
#define			S						second
#define			endl					'\n'
#define			sep						' '
#define			pb						push_back
#define			Mp						make_pair
#define			all(x)					(x).begin(),(x).end()
#define			len(x)					((ll) (x).size())

const int maxn = 600 + 7;

int n, d;
vector<int> res, resx;
bool mark[maxn];

vector<int> longest_trip(int N, int D) {
	n = N; d = D;
	if (d >= 2) {
		if (are_connected({0}, {1})) {
			res.pb(0); mark[0] = 1;
			res.pb(1); mark[1] = 1;
		}
		else {
			res.pb(0); mark[0] = 1;
			res.pb(2); mark[2] = 1;
		}
		for (int i = 0; i < n; i++) {
			if (mark[i]) continue;
			if (are_connected({i}, {res.back()})) res.pb(i);
			else {
				resx.clear(); swap(res, resx);
				res.pb(i);
				for (int x : resx) res.pb(x);
			}
		}
	}
	else {
		
	}
	return res;
}
# 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 Incorrect 0 ms 344 KB Incorrect
2 Halted 0 ms 0 KB -
# 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 Incorrect 0 ms 344 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Incorrect
2 Halted 0 ms 0 KB -