# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1066911 |
2024-08-20T08:43:37 Z |
김은성(#11121) |
Speedrun (RMI21_speedrun) |
C++17 |
|
63 ms |
944 KB |
#include "speedrun.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> child[1009];
vector<int> graph[1009];
int par[1009];
void settree(int v){
for(int u: graph[v]){
if(par[v] == u)
continue;
par[u] = v;
child[v].push_back(u);
settree(u);
}
}
int leftchild(){
int ans = 0;
for(int i=0; i<10; i++){
if(getHint(i+1))
ans |= (1<<i);
}
return ans;
}
int rightsibling(){
int ans = 0;
for(int i=0; i<10; i++){
if(getHint(i+11))
ans |= (1<<i);
}
return ans;
}
int parent(){
int ans = 0;
for(int i=0; i<10; i++){
if(getHint(i+21))
ans |= (1<<i);
}
return ans;
}
void setnumber(int v, int offset, int mask){
for(int i=0; i<10; i++){
if(mask & (1<<i))
setHint(v, i+offset, 1);
}
}
void assignHints(int subtask, int N, int A[], int B[]) { /* your solution here */
setHintLen(20);
int i;
for(i=1; i<N; i++){
graph[A[i]].push_back(B[i]);
graph[B[i]].push_back(A[i]);
}
for(i=1; i<=N; i++){
if(graph[i].size() == 2){
setnumber(i, 1, graph[i][0]);
setnumber(i, 11, graph[i][1]);
}
else{
setnumber(i, 1, graph[i][0]);
}
}
}
int n;
bool ch[1009];
void dfs(int v){
ch[v] = 1;
for(int u: {leftchild(), rightsibling()}){
if(u && !ch[u]){
goTo(u);
dfs(u);
goTo(v);
}
}
}
void speedrun(int subtask, int N, int start) { /* your solution here */
n = N;
dfs(start);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
18 ms |
688 KB |
Solution didn't visit every node |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
13 ms |
760 KB |
Solution didn't visit every node |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
51 ms |
940 KB |
Output is correct |
2 |
Correct |
63 ms |
684 KB |
Output is correct |
3 |
Correct |
49 ms |
688 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
36 ms |
944 KB |
Solution didn't visit every node |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
30 ms |
684 KB |
Solution didn't visit every node |
2 |
Halted |
0 ms |
0 KB |
- |