답안 #973477

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
973477 2024-05-02T05:10:40 Z steveonalex Speedrun (RMI21_speedrun) C++17
0 / 100
10 ms 760 KB
#include <bits/stdc++.h>
#include "speedrun.h"


using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define MASK(i) (1LL << (i))
#define GETBIT(mask, i) (((mask) >> (i)) & 1)
#define ALL(v) (v).begin(), (v).end()

ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}

ll LASTBIT(ll mask){return (mask) & (-mask);}
int pop_cnt(ll mask){return __builtin_popcountll(mask);}
int ctz(ll mask){return __builtin_ctzll(mask);}
int logOf(ll mask){return __lg(mask);}

// mt19937_64 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
mt19937_64 rng(1);
ll rngesus(ll l, ll r){return l + (ull) rng() % (r - l + 1);}

template <class T1, class T2>
    bool maximize(T1 &a, T2 b){
        if (a < b) {a = b; return true;}
        return false;
    }

template <class T1, class T2>
    bool minimize(T1 &a, T2 b){
        if (a > b) {a = b; return true;}
        return false;
    }

template <class T>
    void printArr(T& container, string separator = " ", string finish = "\n"){
        for(auto item: container) cout << item << separator;
        cout << finish;
    }


template <class T>
    void remove_dup(vector<T> &a){
        sort(ALL(a));
        a.resize(unique(ALL(a)) - a.begin());
    }

void assignHints (int subtask, int n, int A[], int B[]){
    vector<vector<int>> graph(n+1);
    for(int i = 0; i<n-1; ++i){
        int u = A[i], v = B[i];
        graph[u].push_back(v);
        graph[v].push_back(u);
    }

    setHintLen(n);
    for(int i = 1; i<=n; ++i){
        for(int j: graph[i]){
            setHint(i, j, 1);
        }
    }
}

int hint_length;

void dfs(int u, int p){
    for(int j = 1; j <= hint_length; ++j) if (getHint(j) && (j != p)){
        goTo(j);
        dfs(j, u);
    }
    if (p != u) goTo(p);
}

void speedrun(int subtask , int N, int start ){
    int hint_length = getLength();
    dfs(start, start);
}

// int main(void){
//     ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

//     return 0;
// }

Compilation message

speedrun.cpp: In function 'void speedrun(int, int, int)':
speedrun.cpp:78:9: warning: unused variable 'hint_length' [-Wunused-variable]
   78 |     int hint_length = getLength();
      |         ^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 10 ms 760 KB Solution didn't visit every node
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB The length is too large
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB The length is too large
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB The length is too large
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB The length is too large
2 Halted 0 ms 0 KB -