Submission #764920

# Submission time Handle Problem Language Result Execution time Memory
764920 2023-06-24T06:33:57 Z vjudge1 Speedrun (RMI21_speedrun) C++17
8 / 100
80 ms 47780 KB
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <bitset>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include "speedrun.h"

// Akhmet Issa

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define ent "\n"

const int maxn = 1e6 + 100;
const ll INF = (ll)2e18;
const int inf = (ll)2e9;
const int maxl = 20;
const int MOD = 1e9 + 7;

vector<int> g[maxn];
int used[maxn];

void assignHints(int subtask, int n, int A [], int B []){
    int r = 1;
    for(int i = 1; i < n; i++){
        g[A[i]].push_back(B[i]);
        g[B[i]].push_back(A[i]);
    }
    setHintLen(20);
    for(int i = 1; i <= n; i++){
        if(g[i].size() > 1) r = i;
    }
    for(int i = 1; i <= n; i++){
        if(i == r) continue;
        for(int j = 1; j <= 20; j++){
            if(r & (1<<(j-1))) setHint(i, j, 1);
        }
    }
}

void dfs(int v, int pr, int n){
    used[v] = 1;
    int num = 0;
    for(int i = 1; i <= 20; i++){
        if(getHint(i)) num += (1<<(i-1));
    }
    if(!num){
        for(int to = 1; to <= n; to++){
            if(!used[to]){
                goTo(to);
                dfs(to, v, n);
            }
        }
    } else{
        if(!used[num]){
            goTo(num);
            dfs(num, v, n);
        }
    }
    if(pr) goTo(pr);
}

void speedrun(int subtask, int n, int start){
    dfs(start, 0, n);
}
# Verdict Execution time Memory Grader output
1 Incorrect 69 ms 47532 KB Solution didn't visit every node
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 58 ms 47664 KB Output is correct
2 Correct 49 ms 47780 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 57 ms 47532 KB Solution didn't visit every node
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 80 ms 47672 KB Solution didn't visit every node
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 72 ms 47532 KB Solution didn't visit every node
2 Halted 0 ms 0 KB -