Submission #1335747

#TimeUsernameProblemLanguageResultExecution timeMemory
1335747ezzzaySpeedrun (RMI21_speedrun)C++20
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
#include "speedrun.h"
using namespace std;
#define pb push_back
int n = 0,cnt = 0;
vector<int>vis;
vector<int>vc;
vector<int>v[2000];
void dfs(int a,int p){
    vc.pb(a);
    for(int x=1;x<=10;x++){
        if((1<<(x-1))&p) setHint(a,x,true);
        
    }
    for(int x:a[a]){
        if(x!=p)dfs(x,a);
    }
}
void assignHints(int subtask, int N, int A[], int B[]){
    int n = N;
    for(int i=1;i<n;i++){
        int a= A[i];
        int b = B[i];
        v[b].pb(a);
        v[a].pb(b);
    }
    setHintLen(20);
    dfs(1,0);
    for(int i=0;i<n;i++){
        if(i<n-1){
            for(int x=1;x<=10;x++){
                if((1<<(x-1))&vc[i+1]){
                    setHint(vc[i],x+10,true);
                }
            }
        }
    }
}
int fun1(){
    int cur = 0;
    for(int i=1;i<=10;i++){
        if(getHint(i))cur+= (1<<(i-1));
    }
    return cur;
}
int fun2(){
    int cur = 0;
    for(int i=1;i<=10;i++){
        if(getHint(i+10))cur+= (1<<(i-1));
        
    }
    return cur;
}
void speedrun(int subtask, int N, int start){
    n = N;
    int s = start;
    int cur = fun1();
    while(cur!=0){
        goTo(cur);
        int nw = fun1();
        start = cur;
        cur = nw;
    }
    cur = fun2();
    while(cur!=0){
        while(goTo(cur)==false)goTo(fun1());
        cur = fun2();
    }
}

Compilation message (stderr)

speedrun.cpp: In function 'void dfs(int, int)':
speedrun.cpp:15:16: error: invalid types 'int[int]' for array subscript
   15 |     for(int x:a[a]){
      |                ^