답안 #536949

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
536949 2022-03-14T08:03:01 Z zaneyu Speedrun (RMI21_speedrun) C++14
0 / 100
4 ms 896 KB
#include "speedrun.h"
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define MNTO(x,y) x=min(x,y)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define ll long long
#define ld long double
#define sz(x) (int)x.size()
#define pb push_back
#define unq(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
const int maxn=1e3+5;
using namespace std;
vector<int> v[maxn];
void dfs(int u,int p){
	REP(j,10) setHint(u,j+1,(p&(1<<j))>>j);
	if(sz(v[u])) REP(j,10) setHint(u,j+11,(v[u][0]&(1<<j))>>j);
	REP(j,sz(v[u])){
		int x=v[u][j];
		int nxt=u;
		if(j<sz(v[u])-1) nxt=v[u][j+1];
		REP(j,10) setHint(x,j+21,(nxt&(1<<j))>>j);
		dfs(x,u);
	}
}
void assignHints(int subtask, int n, int A[], int B[]) {
	setHintLen(30);
	REP1(i,n-1){
		if(A[i]>B[i]) swap(A[i],B[i]);
		v[A[i]].pb(B[i]);
	}
	dfs(1,1023);
}
void gotoo(int x){
	if(x==0) assert(false);
	goTo(x);
}
void dfs2(int u){
	int p=0;
	REP(j,10) p=(p<<1)+getHint(10-j);
	int x=0;
	REP(j,10) x=(x<<1)+getHint(20-j);
	if(x==0){
		gotoo(p);
		return;
	}
	while(x!=u){
		gotoo(x);
		int nx=0;
		REP(j,10) nx=(nx<<1)+getHint(30-j);
		dfs2(x);
		x=nx;
	}
	if(u!=1) gotoo(p);
}
void speedrun(int subtask, int n, int start) {
	while(start!=1){
		int p=0;
		REP(j,10) p=(p<<1)+getHint(10-j);
		gotoo(p);
		start=p;
	}
	dfs2(1);
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 876 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 336 KB The length is too large
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 336 KB The length is too large
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 892 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 896 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -