제출 #573048

#제출 시각아이디문제언어결과실행 시간메모리
573048uroskSpeedrun (RMI21_speedrun)C++14
0 / 100
1 ms592 KiB
#include "speedrun.h" #include <bits/stdc++.h> #define ld double #define ll int #define llinf 100000000000000000LL // 10^17 #define pb push_back #define popb pop_back #define fi first #define sc second #define endl '\n' #define pll pair<ll,ll> #define pld pair<ld,ld> #define sz(a) (ll)(a.size()) #define all(a) a.begin(),a.end() #define ceri(a,l,r) {for(ll i_ = l;i_<=r;i_++) cerr<<a[i_]<< " ";cerr<<endl;} #define daj_mi_malo_vremena ios_base::sync_with_stdio(false);cerr.tie(0);cout.tie(0);cin.tie(0); using namespace std; #define maxn 1005 ll n; ll in[maxn]; vector<ll> g[maxn]; ll b[maxn]; ll nxt[maxn]; ll p[maxn]; ll ti = 1; void dfs(ll u,ll par){ in[u] = ti++; b[ti-1] = u; p[u] = par; for(ll s : g[u]){ if(s==par) continue; dfs(s,u); } } void assignHints(int subtask, int N, int A[], int B[]) { /* your solution here */ setHintLen(20); n = N; for(ll i = 1;i<=n;i++){ ll x = A[i]; ll y = B[i]; g[x].pb(y); g[y].pb(x); } dfs(1,0); for(ll i = 1;i<=n;i++) nxt[i] = b[in[i]+1]; for(ll i = 1;i<=n;i++){ for(ll j = 0;j<10;j++) if(p[i]&(1<<j)) setHint(i,j+1,1); for(ll j = 0;j<10;j++) if(nxt[i]&(1<<j)) setHint(i,j+11,1); } } ll getpar(){ ll y = 0; for(ll j = 0;j<10;j++){ if(getHint(j+1)) y+=(1<<j); } return y; } ll getnxt(){ ll y = 0; for(ll j = 0;j<10;j++){ if(getHint(j+11)) y+=(1<<j); } return y; } void speedrun(int subtask, int N, int start) { /* your solution here */ ll x = start; ll n = N; ll y = x; while(y!=1){ y = getpar(); goTo(y); x = y; } y = getnxt(); ll visi = 1; while(x!=0){ if(goTo(y)){ x = y; y = getnxt(); visi++; }else{ x = getpar(); goTo(x); } } return; } /* 5 1 2 2 3 3 4 3 5 3 */

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

speedrun.cpp: In function 'void speedrun(int, int, int)':
speedrun.cpp:69:8: warning: unused variable 'n' [-Wunused-variable]
   69 |     ll n = N;
      |        ^
#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...