Submission #1118599

# Submission time Handle Problem Language Result Execution time Memory
1118599 2024-11-25T18:06:21 Z pera Speedrun (RMI21_speedrun) C++17
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
#include "speedrun.h"
using namespace std;
void assignHints(int subtask , int N , int A[] , int B[]){
   vector<vector<int>> g(N + 1);
   for(int i = 1;i <= N - 1;i ++){
      g[A[i]].emplace_back(B[i]);
      g[B[i]].emplace_back(A[i]);
   }
   vector<int> par(N + 1) , o;
   function<void(int)> dfs = [&](int u){
      o.emplace_back(u);
      for(int v : g[u]){
         if(v != par[u]){
            par[v] = u;
            dfs(v);
         }
      }
   };
   dfs(1);
   setHintLen(20);
   for(int i = 1;i <= N;i ++){
      for(int bit = 0;bit < 10;bit ++){
         setHint(i , bit + 1, par[i] >> bit & 1);
      } 
      for(int bit = 0;bit < 10;bit ++){
         setHint(i , bit + 10 + 1 , o[i % N] >> bit & 1);
      }
   }
}
void speedrun(int subtask , int N , int v){
   int c = 0 , nxt = 0;
   vector<int> vis(N + 1);
   while(c < N){
      c += vis[v] == 0;
      vis[v] = 1;
      if(nxt == 0){
         for(int bit = 0;bit < 10;bit ++){
            nxt += (1 << bit) * getHint(bit + 10 + 1);
         }
      }
      assert(0 < par && par <= N);
      if(goTo(nxt) == true){
         v = nxt;
         nxt = 0;
      }else{
         int par = 0;
         for(int bit = 0;bit < 10;bit ++){
            par += (1 << bit) * getHint(bit + 1);
         }
         assert(0 < par && par <= N);
         goTo(par);
         v = par;
      }
   }
   return;
}

Compilation message

In file included from /usr/include/c++/10/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33,
                 from speedrun.cpp:1:
speedrun.cpp: In function 'void speedrun(int, int, int)':
speedrun.cpp:42:18: error: 'par' was not declared in this scope; did you mean '__pstl::execution::v1::par'?
   42 |       assert(0 < par && par <= N);
      |                  ^~~
In file included from /usr/include/c++/10/pstl/glue_algorithm_defs.h:15,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from speedrun.cpp:1:
/usr/include/c++/10/pstl/execution_defs.h:111:27: note: '__pstl::execution::v1::par' declared here
  111 | constexpr parallel_policy par{};
      |                           ^~~