제출 #642527

#제출 시각아이디문제언어결과실행 시간메모리
642527Tenis0206Speedrun (RMI21_speedrun)C++14
0 / 100
393 ms5408 KiB
#include <bits/stdc++.h> #include "speedrun.h" using namespace std; int l[100005],t[100005]; vector<int> G[100005]; int poz = 0; void dfs(int nod, int dad = 0) { l[++poz] = nod; for(auto it : G[nod]) { if(it==dad) { continue; } t[it] = nod; dfs(it,nod); } } void setDad(int nod, int dad) { for(int b=0;b<10;b++) { bool val = ((dad & (1<<b)) != 0); setHint(nod,b+1,val); } } void setNext(int nod, int next) { for(int b=0;b<10;b++) { bool val = ((next & (1<<b)) != 0); setHint(nod,b+11,val); } } void assignHints(int subtask, int n, int a[], int b[]) { setHintLen(20); for(int i=1;i<n;i++) { G[a[i]].push_back(b[i]); G[b[i]].push_back(a[i]); } dfs(1); for(int i=1;i<=n;i++) { setDad(l[i],t[i]); setNext(l[i],l[i+1]); } } int getDad() { int rez = 0; for(int b=0;b<10;b++) { int val = getHint(b + 1); rez += val * (1<<b); } return rez; } int getNext() { int rez = 0; for(int b=0;b<10;b++) { int val = getHint(b + 11); rez += val * (1<<b); } return rez; } void speedrun(int subtask, int n, int start) { int aux = getLength(); int nod = start; while(nod!=1) { int dad = getDad(); goTo(dad); nod = dad; } for(int i=1;i<n;i++) { int next = getNext(); bool ok = goTo(next); while(!ok) { int dad = getDad(); goTo(dad); ok = goTo(next); } } }

컴파일 시 표준 에러 (stderr) 메시지

speedrun.cpp: In function 'void speedrun(int, int, int)':
speedrun.cpp:84:9: warning: unused variable 'aux' [-Wunused-variable]
   84 |     int aux = getLength();
      |         ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...