| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 956034 | Dan4Life | 로봇 대회 (IOI23_robot) | C++17 | 1 ms | 348 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "robot.h"
#include <bits/stdc++.h>
using namespace std;
void program_pulibot()
{
string dir = "WSEN";
// 0 = unvisited (white)
// 1 = final visit (yellow)
// 2 = blocked (red)
// 3 = temp. visit (blue)
int white = 0, yellow = 1, red = 2, blue = 3;
for(int i = 0; i <= 3; i++){
for(int j = -2; j <= 3; j++){
for(int k = -2; k <= 3; k++){
for(int l = -2; l <= 3; l++){
for(int m = -2; m <= 3; m++){
if(j==-2 and m==-2 and i==blue){
// starting location and color = blue
set_instruction({i,j,k,l,m},yellow,'T');
}
else if(k==-2 and l==-2){
// final location, start coloring with yellow
int pos = -1;
if(j==blue) pos=0;
else if(k==blue) pos=1;
else if(l==blue) pos=2;
else if(m==blue) pos=3;
set_instruction({i,j,k,l,m},yellow,dir[pos]);
}
else if(i!=white){
// we are in the final phase
if(j==red or k==red or l==red or m==red){
// firstly if there's red cell, go there while marking here as yellow
int pos = -1;
if(j==red) pos=0;
else if(k==red) pos=1;
else if(l==red) pos=2;
else if(m==red) pos=3;
set_instruction({i,j,k,l,m},yellow,dir[pos]);
}
else if(j==blue or k==blue or l==blue or m==blue){
// if no red cell, but there are blue cells, go there
int pos = -1;
if(j==blue) pos=0;
else if(k==blue) pos=1;
else if(l==blue) pos=2;
else if(m==blue) pos=3;
set_instruction({i,j,k,l,m},yellow,dir[pos]);
}
else if(i==red or i==yellow){
// if we are in a blocked place already, clear it, traverse back
int pos = -1;
if(j==yellow) pos=0;
else if(k==yellow) pos=1;
else if(l==yellow) pos=2;
else if(m==yellow) pos=3;
set_instruction({i,j,k,l,m},white,dir[pos]);
}
}
else if(j==white or k==white or l==white or m==white){
// if still in the exploration phase and we can explore:
// go to the next unvisited position, randomly
int pos = -1;
if(j==white) pos=0;
else if(k==white) pos=1;
else if(l==white) pos=2;
else if(m==white) pos=3;
set_instruction({i,j,k,l,m},blue,dir[pos]);
}
else if(j==blue or k==blue or l==blue or m==blue){
// no where to go, mark as blocked, backtrack
int pos = -1;
if(j==blue) pos=0;
else if(k==blue) pos=1;
else if(l==blue) pos=2;
else if(m==blue) pos=3;
set_instruction({i,j,k,l,m},red,dir[pos]);
}
}
}
}
}
}
}| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
