Submission #504845

# Submission time Handle Problem Language Result Execution time Memory
504845 2022-01-10T09:10:51 Z socpite Speedrun (RMI21_speedrun) C++14
100 / 100
244 ms 936 KB
#include<bits/stdc++.h>
#include<speedrun.h>
using namespace std;

vector<vector<int>> graph;
vector<int> order;

void sh(int pos, int id, int val){
    for(int i = 0; i < 10; i++){
        setHint(pos, i + id*10+1, val&(1<<i));
    }
}

void DFS(int x, int p){
    sh(x, 0, p);
    order.push_back(x);
    for(auto v: graph[x])if(v!=p)DFS(v, x);
}

int gtval(int id){
    int re = 0;
    for(int i = 0; i < 10; i++){
        re|=(getHint(i+id*10+1)<<i);
    }
    return re;
}

void assignHints (int subtask , int n, int A[], int B[]){
    setHintLen(20);
    graph.resize(n+1);
    for(int i = 1; i < n; i++){
        graph[A[i]].push_back(B[i]);
        graph[B[i]].push_back(A[i]);
    }
    DFS(1, 0);
    for(int i = 0; i < n-1; i++){
        sh(order[i], 1, order[i+1]);
    }
    sh(order[n-1], 1, 0);
}

void speedrun(int subtask , int N, int start ){
    int suuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu = getLength();
    while(gtval(0)){
        goTo(gtval(0));
    }
    int curr = gtval(1);
    while(curr){
        while(!goTo(curr))goTo(gtval(0));
        curr = gtval(1);
    }
}

Compilation message

speedrun.cpp: In function 'void speedrun(int, int, int)':
speedrun.cpp:43:9: warning: unused variable 'suuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu' [-Wunused-variable]
   43 |     int suuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu = getLength();
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 219 ms 672 KB Output is correct
2 Correct 191 ms 844 KB Output is correct
3 Correct 122 ms 936 KB Output is correct
4 Correct 223 ms 736 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 244 ms 716 KB Output is correct
2 Correct 126 ms 868 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 174 ms 872 KB Output is correct
2 Correct 205 ms 788 KB Output is correct
3 Correct 172 ms 864 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 217 ms 780 KB Output is correct
2 Correct 163 ms 756 KB Output is correct
3 Correct 225 ms 836 KB Output is correct
4 Correct 187 ms 796 KB Output is correct
5 Correct 201 ms 780 KB Output is correct
6 Correct 107 ms 708 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 227 ms 676 KB Output is correct
2 Correct 136 ms 868 KB Output is correct
3 Correct 186 ms 660 KB Output is correct
4 Correct 243 ms 744 KB Output is correct
5 Correct 199 ms 720 KB Output is correct
6 Correct 156 ms 752 KB Output is correct
7 Correct 184 ms 748 KB Output is correct