Submission #536860

# Submission time Handle Problem Language Result Execution time Memory
536860 2022-03-14T06:15:15 Z jamezzz Speedrun (RMI21_speedrun) C++17
21 / 100
41 ms 804 KB
#include "speedrun.h"
#include <bits/stdc++.h>
using namespace std;

#define pf printf

void assignHints(int subtask, int N, int A[], int B[]) { /* your solution here */
	if(subtask==1){
		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) { /* your solution here */
	if(subtask==1){
		vector<int> cur(N+1,1),p(N+1,-1);
		int pos=start;
		while(true){
			while(cur[pos]!=N+1&&(getHint(cur[pos])==0||cur[pos]==p[pos]))++cur[pos];
			if(cur[pos]==N+1){
				if(p[pos]==-1)break;
				else goTo(p[pos]),pos=p[pos];
			}
			else{
				goTo(cur[pos]);
				p[cur[pos]]=pos;
				pos=cur[pos]++;
			}
		}
	}
}
# Verdict Execution time Memory Grader output
1 Correct 41 ms 804 KB Output is correct
2 Correct 38 ms 788 KB Output is correct
3 Correct 37 ms 792 KB Output is correct
4 Correct 41 ms 764 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB setHintLen was never called
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB setHintLen was never called
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB setHintLen was never called
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB setHintLen was never called
2 Halted 0 ms 0 KB -