# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
641441 | Summers | Speedrun (RMI21_speedrun) | C++14 | 2 ms | 1036 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "speedrun.h"
#include<bits/stdc++.h>
#include<vector>
using namespace std;
vector<long long>v[10000], s;
long long n, fath[1005];
void dfs(long long vr,long long f)
{
s.push_back(vr);
fath[vr]=f;
for(int i=0;i<v[vr].size();i++)
{
if(v[vr][i]!=f)dfs(v[vr][i],vr);
}
}
void assignHints(int subtask, int N, int A[], int B[]) {
long long i,j;
setHintLen(20);
n=N;
for(i=1;i<=N;i++)
{
v[A[i]].push_back(B[i]);
v[B[i]].push_back(A[i]);
}
dfs(1,-1);
for(i=0;i<s.size();i++)
{
long long f = fath[s[i]];
long long node = s[(i+1)%n];
for(j=1;j<=10;j++)
{
setHint(s[i],j,((1<<(j-1))&f));
setHint(s[i],j+10,((1<<(j-1))&node));
}
}
}
void speedrun(int subtask, int N, int start) {
int i,j;
for(i=1;i<=n;i++)
{
long long node=0;
for(j=11;j<=20;j++)
{
node=node|((getHint(j))<<(j-11));
}
while(!goTo(node))
{
long long f=0;
for(j=1;j<=10;j++)
{
f=f|((getHint(j))<<(j-1));
}
goTo(f);
}
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |