Submission #871518

# Submission time Handle Problem Language Result Execution time Memory
871518 2023-11-11T04:49:22 Z TAhmed33 Speedrun (RMI21_speedrun) C++17
0 / 100
3500 ms 1264 KB
#include <bits/stdc++.h>
#include "speedrun.h"
using namespace std;
void assignHints (int subtask, int n, int a[], int b[]) {
	setHintLen(n);
	bool adj[n + 1][n + 1]; memset(adj, 0, sizeof(adj));
	for (int i = 1; i < n; i++) {
		adj[a[i]][b[i]] = adj[b[i]][a[i]] = 1;
	}
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			setHint(i, j, adj[i][j]);
		}
	}
	return;
}
int adj[1001][1001];
int n;
void dfs (int pos, int par) {
	for (int j = 1; j <= n; j++) {
		if (j == par || pos == j) continue;
		if (adj[pos][j] == 0) continue;
		if (adj[pos][j] == 1) {
			goTo(j); dfs(j, pos); goTo(pos);
		}
		if (adj[pos][j] == -1) {
			int x = goTo(j);
			adj[j][pos] = adj[pos][j] = x;
			if (x) {
				dfs(j, pos);
				goTo(pos);
			} 
		}
	}
}
void speedrun (int subtask, int N, int start) {
	memset(adj, -1, sizeof(adj));
	n = N;
	dfs(start, -1);
	return;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 3525 ms 1264 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB The length is too large
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 500 KB The length is too large
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB The length is too large
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB The length is too large
2 Halted 0 ms 0 KB -