Submission #828536

#TimeUsernameProblemLanguageResultExecution timeMemory
828536GrindMachineSpeedrun (RMI21_speedrun)C++17
0 / 100
149 ms932 KiB
// Om Namah Shivaya #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; template<typename T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; typedef long long int ll; typedef long double ld; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define fastio ios_base::sync_with_stdio(false); cin.tie(NULL) #define pb push_back #define endl '\n' #define sz(a) a.size() #define setbits(x) __builtin_popcountll(x) #define ff first #define ss second #define conts continue #define ceil2(x, y) ((x + y - 1) / (y)) #define all(a) a.begin(), a.end() #define rall(a) a.rbegin(), a.rend() #define yes cout << "Yes" << endl #define no cout << "No" << endl #define rep(i, n) for(int i = 0; i < n; ++i) #define rep1(i, n) for(int i = 1; i <= n; ++i) #define rev(i, s, e) for(int i = s; i >= e; --i) #define trav(i, a) for(auto &i : a) template<typename T> void amin(T &a, T b) { a = min(a, b); } template<typename T> void amax(T &a, T b) { a = max(a, b); } #ifdef LOCAL #include "debug.h" #else #define debug(x) 42 #endif /* */ const int MOD = 1e9 + 7; const int N = 1e3 + 5; const int inf1 = int(1e9) + 5; const ll inf2 = ll(1e18) + 5; #include "speedrun.h" vector<int> adj[N]; vector<int> par(N); vector<int> order; void dfs(int u, int p){ par[u] = p; order.pb(u); trav(v,adj[u]){ if(v == p) conts; dfs(v,u); } } void assignHints(int subtask, int n, int A[], int B[]) { /* your solution here */ rep1(i,n-1){ int u = A[i], v = B[i]; adj[u].pb(v), adj[v].pb(u); } dfs(1,-1); setHintLen(20); rep(i,n){ // first 10 bits = par // next 10 bits = next guy in tin time order int u = order[i]; if(u != 1){ int p = par[u]; rep(bit,10){ int b = 0; if(p & (1<<bit)) b = 1; setHint(u,bit+1,b); } } if(i+1 < n){ int nxt = order[i+1]; rep(bit,10){ int b = 0; if(nxt & (1<<bit)) b = 1; setHint(u,bit+11,b); } } } } void speedrun(int subtask, int n, int start) { /* your solution here */ assert(0); while(start != 1){ int p = 0; rep(bit,10){ if(getHint(bit+1)){ p |= (1<<bit); } } goTo(p); start = p; } int vis_cnt = 1; int u = 1; while(vis_cnt < n){ int v = 0; rep(bit,10){ if(getHint(bit+11)){ v |= (1<<bit); } } while(true){ bool ok = goTo(v); if(ok) break; goTo(par[u]); u = par[u]; } par[v] = u; u = v; vis_cnt++; } }
#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...