Submission #933606

#TimeUsernameProblemLanguageResultExecution timeMemory
933606vjudge1Speedrun (RMI21_speedrun)C++17
Compilation error
0 ms0 KiB
void assignHints(int subtask, int N , int A[], int B[]){ setHintlen(20); vi cont(N+2, 0),graph[N+2]; fore(i,1,N){graph[A[i]].pb(B[i]); graph[B[i]].pb(A[i]); if(subtask == 1){ setHint(A[i], B[i], 1); setHint(B[i], A[i], 1); }else if(subtask == 2){ cont[A[i]]++;cont[B[i]]++; } } if(subtask==2){ if(N==1)return; fore(i,1,N){ if(cont[i]>1){ setHint(i, 1, 1); setHint(i, 2, 1); }else{// no es el centro setHint(i, 1, 1); } } }else if (subtask == 3){ fore(i,1,N){bool ini = 1; for(int v : graph[i]){ fo(j,10){ int k = j+(!ini ? 10 : 0 ); setHint(i, k, (v&(1<<k) ? 1 : 0)); } ini = 0; } } } } 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){if(N==1)return; vis.resize(N+2,0);precalc.resize(N+2,0);szn=N; graph.resize(N+2);getLength(); if(subtask == 2){ int num = 0; fore(i,1,N+1){ if(getHint(i))num++; } if(num>=2){ fore(i,1,N+1){if(i==start)continue; goTo(i); goTo(start); } }else{ int p = 0; fore(i,1,N+1)if(i!=start and goTo(i)){p=i;break;} fore(i,1,N+1){if(i==p || i==start) continue; goTo(i);goTo(p); } } return; }else if(subtask == 3 ){ return; } vis[start] = 1; dfs(start); }

Compilation message (stderr)

speedrun.cpp: In function 'void assignHints(int, int, int*, int*)':
speedrun.cpp:2:5: error: 'setHintlen' was not declared in this scope
    2 |     setHintlen(20);
      |     ^~~~~~~~~~
speedrun.cpp:3:5: error: 'vi' was not declared in this scope
    3 |     vi cont(N+2, 0),graph[N+2];
      |     ^~
speedrun.cpp:4:10: error: 'i' was not declared in this scope
    4 |     fore(i,1,N){graph[A[i]].pb(B[i]); graph[B[i]].pb(A[i]);
      |          ^
speedrun.cpp:4:5: error: 'fore' was not declared in this scope
    4 |     fore(i,1,N){graph[A[i]].pb(B[i]); graph[B[i]].pb(A[i]);
      |     ^~~~
speedrun.cpp: At global scope:
speedrun.cpp:34:1: error: 'vector' does not name a type
   34 | vector<vector<int>> graph;
      | ^~~~~~
speedrun.cpp:35:1: error: 'vector' does not name a type
   35 | vector<bool> precalc, vis;int szn;
      | ^~~~~~
speedrun.cpp: In function 'void dfs(int, int)':
speedrun.cpp:37:9: error: 'precalc' was not declared in this scope
   37 |     if(!precalc[nodo]){
      |         ^~~~~~~
speedrun.cpp:39:14: error: 'i' was not declared in this scope
   39 |         fore(i,1,szn+1){
      |              ^
speedrun.cpp:39:9: error: 'fore' was not declared in this scope
   39 |         fore(i,1,szn+1){
      |         ^~~~
speedrun.cpp:45:17: error: 'graph' was not declared in this scope
   45 |     for(int v : graph[nodo]){
      |                 ^~~~~
speedrun.cpp:46:13: error: 'vis' was not declared in this scope
   46 |         if(!vis[v]){
      |             ^~~
speedrun.cpp:48:13: error: 'goTo' was not declared in this scope
   48 |             goTo(v);dfs(v, nodo);
      |             ^~~~
speedrun.cpp:52:5: error: 'goTo' was not declared in this scope
   52 |     goTo(donde);
      |     ^~~~
speedrun.cpp: In function 'void speedrun(int, int, int)':
speedrun.cpp:55:5: error: 'vis' was not declared in this scope
   55 |     vis.resize(N+2,0);precalc.resize(N+2,0);szn=N;
      |     ^~~
speedrun.cpp:55:23: error: 'precalc' was not declared in this scope
   55 |     vis.resize(N+2,0);precalc.resize(N+2,0);szn=N;
      |                       ^~~~~~~
speedrun.cpp:56:5: error: 'graph' was not declared in this scope
   56 |     graph.resize(N+2);getLength();
      |     ^~~~~
speedrun.cpp:56:23: error: 'getLength' was not declared in this scope
   56 |     graph.resize(N+2);getLength();
      |                       ^~~~~~~~~
speedrun.cpp:59:14: error: 'i' was not declared in this scope
   59 |         fore(i,1,N+1){
      |              ^
speedrun.cpp:59:9: error: 'fore' was not declared in this scope
   59 |         fore(i,1,N+1){
      |         ^~~~
speedrun.cpp:68:17: warning: unused variable 'p' [-Wunused-variable]
   68 |             int p = 0;
      |                 ^