Submission #1066916

# Submission time Handle Problem Language Result Execution time Memory
1066916 2024-08-20T08:45:45 Z 김은성(#11121) Speedrun (RMI21_speedrun) C++17
8 / 100
22 ms 980 KB
#include "speedrun.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> child[1009];
vector<int> graph[1009];
int par[1009];
void settree(int v){
	for(int u: graph[v]){
		if(par[v] == u)
			continue;
		par[u] = v;
		child[v].push_back(u);
		settree(u);
	}
}
int leftchild(){
	int ans = 0;
	for(int i=0; i<10; i++){
		if(getHint(i+1))
			ans |= (1<<i);
	}
	return ans;
}
int rightsibling(){
	int ans = 0;
	for(int i=0; i<10; i++){
		if(getHint(i+11))
			ans |= (1<<i);
	}
	return ans;
}
int parent(){
	int ans = 0;
	for(int i=0; i<10; i++){
		if(getHint(i+21))
			ans |= (1<<i);
	}
	return ans;
}
void setnumber(int v, int offset, int mask){
	for(int i=0; i<10; i++){
		if(mask & (1<<i))
			setHint(v, i+offset, 1);
	}
}
void assignHints(int subtask, int N, int A[], int B[]) { /* your solution here */
	setHintLen(20);
	int i;
	for(i=1; i<N; i++){
		graph[A[i]].push_back(B[i]);
		graph[B[i]].push_back(A[i]);
	}
	for(i=1; i<=N; i++){
		if(graph[i].size() == 1){
			setnumber(i, 1, graph[i][0]);
		}
	}
}
int n;
bool ch[1009];
void dfs(int v){
	ch[v] = 1;
	int u = leftchild();
	if(u){
		if(u && !ch[u]){
			goTo(u);
			dfs(u);
			goTo(v);
		}
	}
	else{
		for(int i=1; i<=n; i++){
			if(i && !ch[i]){
			goTo(i);
			dfs(i);
			goTo(v);
		}
		}
	}
}
void speedrun(int subtask, int N, int start) { /* your solution here */
	n = N;
	dfs(start);
}
# Verdict Execution time Memory Grader output
1 Incorrect 20 ms 764 KB Solution didn't visit every node
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 22 ms 936 KB Output is correct
2 Correct 20 ms 940 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 980 KB Solution didn't visit every node
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 17 ms 776 KB Solution didn't visit every node
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 15 ms 764 KB Solution didn't visit every node
2 Halted 0 ms 0 KB -