Submission #503662

# Submission time Handle Problem Language Result Execution time Memory
503662 2022-01-08T14:42:45 Z blue Speedrun (RMI21_speedrun) C++17
8 / 100
107 ms 660 KB
#include "speedrun.h"
#include <vector>
#include <algorithm>
using namespace std;

using vi = vector<int>;

void assignHints(int subtask, int N, int A[], int B[])
{
    vi deg(1+N, 0);

    for(int e = 1; e < N; e++)
    {
        deg[A[e]]++;
        deg[B[e]]++;
    }

    int x = 0;
    for(int i = 1; i <= N; i++)
        if(deg[i] == N-1)
            x = i;

    setHintLen(10);

    for(int u = 1; u <= N; u++)
            for(int b = 0; b < 10; b++)
                setHint(u, b+1, bool(x & (1 << b)));
    // setHint(x, 1, 1);
}

void speedrun(int subtask, int N, int start)
{
    int x = 0;
    for(int b = 0; b < 10; b++)
        x += (1 << b) * getHint(b+1);

    if(x == start)
    {
        for(int y = 1; y <= N; y++)
        {
            if(y == x) continue;
            goTo(y);
            goTo(x);
        }
    }
    else
    {
        goTo(x);
        for(int y = 1; y <= N; y++)
        {
            if(y == x || y == start) continue;
            goTo(y);
            goTo(x);
        }
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 75 ms 548 KB Invalid node index to goTo
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 107 ms 648 KB Output is correct
2 Correct 94 ms 660 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 75 ms 572 KB Invalid node index to goTo
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 73 ms 472 KB Invalid node index to goTo
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 60 ms 532 KB Invalid node index to goTo
2 Halted 0 ms 0 KB -