# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
859152 |
2023-10-09T20:41:05 Z |
Vanio |
Speedrun (RMI21_speedrun) |
C++17 |
|
99 ms |
2148 KB |
#include<bits/stdc++.h>
#include "speedrun.h"
using namespace std;
int n,f[1001],pr,f2[1001];
vector<int> v[1001];
void encode(int p, int k, int indx){
int i=indx;
while(k>0){
setHint(p,i,k%2);
k/=2;
i++;
}
}
void dfsen(int k, int par){
if(f[pr]==2){
encode(pr,k,1);
encode(pr,par,11);
}
if(v[k].size()==1){f[k]=2; pr=k; return;}
f[k]=1;
pr=k;
encode(k,par,1);
for(int i=0;i<v[k].size();i++){
if(f[v[k][i]]==0){
if(f2[k]==0){
encode(k,v[k][i],11);
f2[k]=1;
}
dfsen(v[k][i],k);
}
}
}
void assignHints(int subtask, int N, int a[], int b[]){
n=N;
int i;
for(i=1;i<n;i++){
v[a[i]].push_back(b[i]);
v[b[i]].push_back(a[i]);
}
setHintLen(20);
dfsen(1,0);
}
int decode(int indx){
int s=0,t=512,i;
for(i=indx;i>indx-10;i--){
s+=getHint(i)*t;
t/=2;
}
return s;
}
void dfssr(int k,int par){
cout<<k<<" "<<par<<" "<<decode(10)<<" "<<decode(20)<<endl;
if(par!=decode(10)){
cout<<"maika ti\n";
v[decode(20)].push_back(decode(10));
goTo(par);
return;
}
v[k].push_back(decode(20));
for(int i=0;i<v[k].size();i++){
goTo(v[k][i]);
dfssr(v[k][i],k);
}
if(par==0) return;
goTo(par);
}
void speedrun(int subtask, int N, int start){
n=N;
int i,t1,t2;
t1=decode(10);
t2=decode(20);
if(t1==0 && t2==0){
for(i=1;i<=n;i++){
if(i==start) continue;
if(goTo(i)) break;
}
}
else if(t1!=0){
if(!goTo(t1)){
for(i=1;i<=n;i++){
if(i==start || i==t1) continue;
if(goTo(i)) break;
}
}
}
while(t1=decode(10)) goTo(t1);
dfssr(1,0);
}
Compilation message
speedrun.cpp: In function 'void dfsen(int, int)':
speedrun.cpp:26:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
26 | for(int i=0;i<v[k].size();i++){
| ~^~~~~~~~~~~~
speedrun.cpp: In function 'void dfssr(int, int)':
speedrun.cpp:68:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
68 | for(int i=0;i<v[k].size();i++){
| ~^~~~~~~~~~~~
speedrun.cpp: In function 'void speedrun(int, int, int)':
speedrun.cpp:95:13: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
95 | while(t1=decode(10)) goTo(t1);
| ~~^~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
88 ms |
880 KB |
speedrun must not call setHintLen or setHint |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
968 KB |
speedrun must not call setHintLen or setHint |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
75 ms |
2148 KB |
speedrun must not call setHintLen or setHint |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
93 ms |
876 KB |
speedrun must not call setHintLen or setHint |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
99 ms |
1144 KB |
speedrun must not call setHintLen or setHint |
2 |
Halted |
0 ms |
0 KB |
- |