Submission #933585

# Submission time Handle Problem Language Result Execution time Memory
933585 2024-02-26T00:32:18 Z vjudge1 Speedrun (RMI21_speedrun) C++17
21 / 100
26 ms 2172 KB
#include <bits/stdc++.h>
#include "speedrun.h"
#define endl '\n'
#define mp make_pair
#define f first
#define s second
#define pb push_back
#define all(x) x.begin(),x.end()
#define fore(i,l,r) for(int i = l; i < r;i++)
#define forex(i,r,l) for(int i = r; i>= l;i--)
#define fo(i,n) fore(i,0,n)
#define ffo(i,n) forex(i,n-1,0)
#define lsb(x) x&(-x)
using namespace std;
using ii = pair<int,int>;using ll = long long; using ull = unsigned long long;
using vi = vector<int>;
// const int maxN = 30;
// int hintlen,mistart;vi res;
// int num[maxN];
// void setHintlen(int sz){
//     hintlen=sz;
// }
// void setHint(int a, int b, bool cl){
//     if(num[a]&1<<b == cl)return;
//     num[a]^=1<<b;
// }
// int getLength(){return hintlen;}
// bool getHint(int j ){
//     cout << mistart << " " << j << endl; cout.flush();
//     return (num[mistart]&(1<<j) ? 1 : 0 );
// }
// bool goTo(int j){
//     if(num[mistart]&(1<<j) == 0)return false;
//     res.pb(j);
//     mistart=j;
//     return true;
// }
void assignHints(int subtask, int N , int A[], int B[]){
    setHintLen(N);
    fore(i,1,N){
        setHint(A[i], B[i], 1);
        setHint(B[i], A[i], 1);
    }
}
vector<vector<int>> graph;
vector<bool> precalc, vis;int szn;
void dfs(int nodo, int donde = 0){
    if(!precalc[nodo]){
        precalc[nodo] = 1;
        fore(i,1,szn+1){
            if(getHint(i)){
                graph[nodo].pb(i);
            }
        }
    }
    for(int v : graph[nodo]){
        if(!vis[v]){
            vis[v]=1;
            goTo(v);dfs(v, nodo);
        }
    }
    if(donde == 0)return ;
    goTo(donde);
}
void speedrun(int subtask, int N, int start){
    vis.resize(N+2,0);precalc.resize(N+2,0);szn=N;
    graph.resize(N+2);getLength();
    vis[start] = 1;
    dfs(start);
}
# Verdict Execution time Memory Grader output
1 Correct 26 ms 2172 KB Output is correct
2 Correct 24 ms 1860 KB Output is correct
3 Correct 26 ms 1772 KB Output is correct
4 Correct 22 ms 1912 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB The length is too large
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB The length is too large
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB The length is too large
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB The length is too large
2 Halted 0 ms 0 KB -