제출 #1135286

#제출 시각아이디문제언어결과실행 시간메모리
1135286GraySpeedrun (RMI21_speedrun)C++20
0 / 100
0 ms576 KiB
#include "speedrun.h" #include <bits/stdc++.h> #define ll long long #define ull unsigned long long #define ff first #define ss second #define ln "\n" #define MOD (ll)1e9+7 #define INF (ll)1e18 using namespace std; vector<vector<ll> > gr; void dfs(ll u, ll p, vector<ll> &par, vector<ll> &ord){ ord.push_back(u); par[u]=p; for (auto v:gr[u]){ if (v==p) continue; dfs(v, u, par, ord); } } void assignHints(int subtask, int N, int A[], int B[]) { gr.resize(N+1); ll n = N; for (ll i=1; i<N; i++) { gr[A[i]].push_back(B[i]); gr[B[i]].push_back(A[i]); } vector<ll> par(n+1), ord, data2(n+1); dfs(1, -1, par, ord); // cout << "Came" << endl; for (ll i=0; i<n; i++){ data2[ord[i]]=ord[(i+1)%n]; } setHintLen(20); for (ll i=1; i<=n; i++){ for (ll j=0; j<10; j++) if ((1ull<<j)&par[i]) setHint(i, j, 1); for (ll j=10; j<20; j++) if ((1ull<<(j-10))&data2[i]) setHint(i, j, 1); } // cout << "Came" << endl; } void speedrun(int subtask, int N, int start) { for (ll i=0; i<N; i++){ ll par=0; for (ll j=0; j<10; j++) if (getHint(j)) par+=(1ull<<j); ll next=0; for (ll j=10; j<20; j++) if (getHint(j)) next+=(1ull<<(j-10)); // cout << start << " - " << par << " - " << next << endl; while (!goTo(next)){ goTo(par); par=0; for (ll j=0; j<10; j++) if (getHint(j)) par+=(1ull<<j); } // cout << "ca" << endl; } }
#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...