Submission #736970

# Submission time Handle Problem Language Result Execution time Memory
736970 2023-05-06T11:54:33 Z jk410 Speedrun (RMI21_speedrun) C++17
0 / 100
32 ms 548 KB
#include "speedrun.h"

void assignHints(int subtask, int N, int A[], int B[]) {
	setHintLen(N);
	for (int i = 1; i < N; i++) {
		setHint(A[i], B[i], 1);
		setHint(B[i], A[i], 1);
	}
}

void speedrun(int subtask, int N, int start) {
	int Idx[1001], Par[1001];
	for (int i = 1; i <= N; i++)
		Idx[i] = 1;
	int l = getLength();
	int cur = start;
	while (1) {
		if (Idx[cur] > N) {
			if (!Par[cur])
				return;
			goTo(Par[cur]);
			cur = Par[cur];
		}
		if (Idx[cur] == Par[cur]) {
			Idx[cur]++;
			continue;
		}
		if (getHint(Idx[cur]++)) {
			int nxt = Idx[cur] - 1;
			Par[nxt] = cur;
			goTo(nxt);
			cur = nxt;
		}
	}
}

Compilation message

speedrun.cpp: In function 'void speedrun(int, int, int)':
speedrun.cpp:15:6: warning: unused variable 'l' [-Wunused-variable]
   15 |  int l = getLength();
      |      ^
speedrun.cpp:19:16: warning: 'Par[start]' is used uninitialized in this function [-Wuninitialized]
   19 |    if (!Par[cur])
      |         ~~~~~~~^
# Verdict Execution time Memory Grader output
1 Incorrect 32 ms 548 KB Invalid bit index for getHint
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB The length is too large
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB The length is too large
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB The length is too large
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB The length is too large
2 Halted 0 ms 0 KB -