답안 #764960

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
764960 2023-06-24T06:59:47 Z vjudge1 Speedrun (RMI21_speedrun) C++17
0 / 100
173 ms 48280 KB
#include <bits/stdc++.h>
#include "speedrun.h"
using namespace std;
const int MAXN=1e3+5;
vector<int> sos[MAXN][MAXN];
int cnt[MAXN];
vector<vector<int> > g(MAXN);
void assignHints(int subtask, int N, int A[], int B[]) {
	setHintLen(20);
	for(int i=1; i<N; i++) {
		g[A[i]].push_back(B[i]);
		g[B[i]].push_back(A[i]);
	}
	for(int i=1; i<=N; i++) {
		int sz=g[i].size();
		sos[sz][++cnt[sz]]=g[i];
		for(int j=1; j<=10; j++) {
			setHint(i, j, (sz&(1<<(j-1))? 1 : 0));
		}
		for(int j=11; j<=20; j++) {
			setHint(i, j, (cnt[sz]&(1<<(j-11)) ? 1 : 0));
		}
	}
	return;
}
int us[MAXN];
void dfs(int v, int p) {
	us[v]=1;
	int x=0, y=0;
	for(int j=1; j<=10; j++) {
		if(getHint(j))x+=(1<<(j-1));
	}
	for(int j=11; j<=20; j++) {
		if(getHint(j))y+=(1<<(j-11));
	}
	vector<int> gg=sos[x][y];
	for(auto to : gg) {
		if(!us[to]) {
			goTo(to);
			dfs(to, v);
		}
	}
	if(v!=p)goTo(p);
	else return;
}
void speedrun(int subtask, int N, int start) {
	int len=getLength();
	dfs(start, start);
	return;
}

Compilation message

speedrun.cpp: In function 'void speedrun(int, int, int)':
speedrun.cpp:47:6: warning: unused variable 'len' [-Wunused-variable]
   47 |  int len=getLength();
      |      ^~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 152 ms 48244 KB Solution didn't visit every node
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 167 ms 48168 KB Solution didn't visit every node
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 173 ms 48272 KB Solution didn't visit every node
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 134 ms 48140 KB Solution didn't visit every node
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 132 ms 48280 KB Solution didn't visit every node
2 Halted 0 ms 0 KB -