Submission #860330

#TimeUsernameProblemLanguageResultExecution timeMemory
860330ASN49KSpeedrun (RMI21_speedrun)C++14
Compilation error
0 ms0 KiB
#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); setHintLen(20); for(int i=1;i<n;i++) { g[a[i]].pb(b[i]); g[b[i]].pb(a[i]); } vector<int>nodes; function<void(int,int)>dfs=[&](int x,int tt) { for(int i=0;i<10;i++) { setHint(x,i,tt&(1<<i)>0); } nodes.pb(x); }; dfs(1,0); nodes.pb(0); for(int i=1;i<=n;i++) { for(int j=0;j<10;j++) { setHint(nodes[i-1],j+10,nodes[i]&(1<<j)>0); } } } void speedrun(int subtask , int n, int x ) { auto tata=[&]() { int sol=0; for(int i=0;i<10;i++) { if(getHint(i)) { sol|=(1<<i); } } return sol; }; auto next=[&]() { int sol=0; for(int i=0;i<10;i++) { if(getHint(i+10)) { sol|=(1<<i); } } return sol; }; while(x!=1) { x=tata(); goTo(x); } for(int i=1;i<n;i++) { int urm=next(); while(!goTo(urm)) { goTo(tata()); } } }

Compilation message (stderr)

speedrun.cpp: In function 'void assignHints(int, int, int*, int*)':
speedrun.cpp:10:17: error: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'class std::vector<int>'} has no member named 'pb'
   10 |         g[a[i]].pb(b[i]);
      |                 ^~
speedrun.cpp:11:17: error: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'class std::vector<int>'} has no member named 'pb'
   11 |         g[b[i]].pb(a[i]);
      |                 ^~
speedrun.cpp: In lambda function:
speedrun.cpp:18:34: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
   18 |             setHint(x,i,tt&(1<<i)>0);
      |                            ~~~~~~^~
speedrun.cpp:20:15: error: 'class std::vector<int>' has no member named 'pb'
   20 |         nodes.pb(x);
      |               ^~
speedrun.cpp: In function 'void assignHints(int, int, int*, int*)':
speedrun.cpp:23:11: error: 'class std::vector<int>' has no member named 'pb'
   23 |     nodes.pb(0);
      |           ^~
speedrun.cpp:28:52: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
   28 |             setHint(nodes[i-1],j+10,nodes[i]&(1<<j)>0);
      |                                              ~~~~~~^~