답안 #992023

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
992023 2024-06-03T15:18:25 Z De3b0o Speedrun (RMI21_speedrun) C++14
0 / 100
219 ms 2308 KB
#include "speedrun.h"
#include<bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define in insert
#define pb push_back
#define ppb pop_back()
#define d3 ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define cans cout << ans << "\n";
#define yes cout << "Yes" << "\n";
#define no cout << "No" << "\n";
#define pll pair<ll,ll>
#define lin cout << "\n";
#define sqr 340
#define mod 1000000007
#define mid ((l+r)/2)
#define lc (2*n)
#define rc (2*n+1)

using namespace std;

const ll NN = 1009;

ll n;
ll p[NN];
vector<ll> adj[NN];
vector<ll> df;
ll ti[NN];
ll t;
ll vis;
ll vs[NN];

void dfs(ll x , ll pr)
{
    p[x]=pr;
    df.pb(x);
    ti[x]=t;
    t++;
    for(auto it : adj[x])
    {
        if(it==pr)
            continue;
        dfs(it,x);
    }
}

void assignHints(int subtask, int N, int A[], int B[])
{
    setHintLen(20);
    n=N;
    for(int i = 1 ; n>i ; i++)
    {
        adj[A[i]].pb(B[i]);
        adj[B[i]].pb(A[i]);
    }
    dfs(1,0);
    df.pb(0);
    for(int i = 1 ; n>=i ; i++)
    {
        ll b = 1;
        for(int j = 1 ; 10>=j ; j++)
        {
            if(b&p[i])
                setHint(i,j,1);
            b*=2;
        }
        b=1;
        for(int j = 11 ; 20>=j ; j++)
        {
            if(b&df[ti[i]+1])
                setHint(i,j,1);
            b*=2;
        }
    }
}

void v(ll x , ll d)
{
    if(vs[x]==0)
        vis++;
    if(vis==n)
        return;
    vs[x]=1;
    ll pr = 0;
    ll b = 1;
    for(int j = 1 ; 10>=j ; j++)
    {
        if(getHint(j))
            pr+=b;
        b*=2;
    }
    if(d)
    {
        if(goTo(d))
            v(d,0);
        else
            v(pr,d);
    }
    b=1;
    ll t1 = 0;
    for(int j = 11 ; 20>=j ; j++)
    {
        if(getHint(j))
            t1+=b;
        b*=2;
    }
    if(goTo(t1))
        v(t1,0);
    else
        v(pr,t1);
}

void speedrun(int subtask, int N, int start)
{
    while(true)
    {
        ll b = 1;
        ll y = 0;
        for(int j = 1 ; 10>=j ; j++)
        {
            if(getHint(j))
                y+=b;
            b*=2;
        }
        if(y==0)
            break;
        goTo(y);
    }
    v(1,0);
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 61 ms 940 KB Used too many wrong interactions
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 43 ms 1192 KB Used too many wrong interactions
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 62 ms 1188 KB Used too many wrong interactions
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 219 ms 2308 KB Used too many wrong interactions
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 61 ms 940 KB Used too many wrong interactions
2 Halted 0 ms 0 KB -