Submission #1066910

# Submission time Handle Problem Language Result Execution time Memory
1066910 2024-08-20T08:42:25 Z 김은성(#11121) Speedrun (RMI21_speedrun) C++17
0 / 100
31 ms 684 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(30);
	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() == 2){
			setnumber(i, 1, graph[i][0]);
			setnumber(i, 11, graph[i][1]);
		}
		else{
			setnumber(i, 1, graph[i][0]);
		}
	}
}
int n;
bool ch[1009];
void dfs(int v){
	ch[v] = 1;
	for(int u: {leftchild(), rightsibling()}){
		if(u && !ch[u]){
			goTo(u);
			dfs(u);
			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 30 ms 684 KB Solution didn't visit every node
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 -
# 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 28 ms 684 KB Solution didn't visit every node
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 31 ms 684 KB Solution didn't visit every node
2 Halted 0 ms 0 KB -