Submission #933583

# Submission time Handle Problem Language Result Execution time Memory
933583 2024-02-26T00:29:50 Z vjudge1 Speedrun (RMI21_speedrun) C++17
0 / 100
1 ms 768 KB
//subtask 8 points
#include <algorithm>
#include <fstream>
#include <vector>
#include <queue>
#include <stack>
#include <iostream>
#include <cmath>
#include <queue>
#include <set>
#include <cstring>
#include <map>
#include <unordered_map>
//#include <bits/extc++.h>
#define F first
#define S second
#define PB push_back
using namespace std;
//using namespace __gnu_pbds;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ost;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<pair<int, ii>> viii;
typedef vector<vii> vvii;
typedef vector<ll> vll;
typedef vector<vll> vvll;

void setHintLen (int l);
void setHint(int i, int j, bool b);
int getLength ();
bool getHint(int j);
bool goTo(int x);


vvi al;
int par;

int findPar(int n){
    int ans=1;
    for(int i=1;i<=n;i++)
        if(al[i].size()>1)
            ans=i;
    return ans;
}

void assignHints(int subtasks, int n, int a[], int b[]){
    al.resize(n+1, vi());
    for(int i=1;i<n;i++){
        al[a[i]].PB(b[i]);
        al[b[i]].PB(a[i]);
    }
    par=findPar(n);
    setHintLen(1);
}

void speedrun(int subtasks, int n, int start){
    bool vis[n+1];
    memset(vis, false, n+1);
    vis[start]=true;
    if(start!=par){
        goTo(par);
        vis[par]=true;
    }
    for(int i=1;i<=n;i++){
        if(!vis[i]){
            vis[i]=true;
            goTo(i);
            goTo(par);
        }
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 764 KB Invalid node index to goTo
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 768 KB Invalid node index to goTo
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 768 KB Invalid node index to goTo
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 764 KB Invalid node index to goTo
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 768 KB Invalid node index to goTo
2 Halted 0 ms 0 KB -