# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
857718 |
2023-10-06T16:22:35 Z |
Vanio |
Speedrun (RMI21_speedrun) |
C++17 |
|
56 ms |
1880 KB |
#include<bits/stdc++.h>
#include "speedrun.h"
using namespace std;
void assignHints(int subtask, int n, int a[], int b[]){
if(subtask==1){
int i;
setHintLen(n);
for(i=1;i<n;i++){
setHint(a[i],b[i],1);
setHint(b[i],a[i],1);
}
}
if(subtask==2){
int c;
if(a[2]==a[1] || a[2]==b[1]) c=a[2];
else c=b[2];
int l=1,h[20];
while(c>0){
h[l]=c%2;
c/=2;
l++;
}
setHintLen(l-1);
int i,j;
for(i=1;i<=n;i++){
if(i==c) continue;
for(j=1;j<l;j++) setHint(i,j,h[j]);
}
}
}
int n;
bool f[1001];
void rec(int k, int p){
int i;
f[k]=1;
for(i=1;i<=n;i++){
if(getHint(i) && !f[i]){
goTo(i);
rec(i,k);
}
}
if(p==0) return;
goTo(p);
}
void speedrun(int subtask, int N, int start){
n=N;
if(subtask==1) rec(start,0);
if(subtask==2){
int i,F=0,c=0,t=1;
int l = getLength();
for(i=1;i<=l;i++) if(getHint(i)==1){F=1; break;}
if(F){
for(i=1;i<l;i++) t*=2;
for(i=l-1;i>=1;i--){
c+=getHint(i)*t;
t/=2;
}
goTo(c);
}
else c=start;
for(i=1;i<=n;i++){
if(i==c) continue;
goTo(i);
goTo(c);
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
25 ms |
1880 KB |
Output is correct |
2 |
Correct |
25 ms |
1276 KB |
Output is correct |
3 |
Correct |
23 ms |
1792 KB |
Output is correct |
4 |
Correct |
26 ms |
1656 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
56 ms |
684 KB |
Solution didn't visit every node |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
setHintLen was never called |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
setHintLen was never called |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
setHintLen was never called |
2 |
Halted |
0 ms |
0 KB |
- |