이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "robot.h"
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define ll int
#define F first
#define S second
#define ld long double
#define sz(x) (ll)x.size()
#define MID ((l+r)/2)
#define pb push_back
#define dbg(x) cout<<#x<<": "<<x<<endl;
typedef vector <ll> vi;
typedef pair <ll,ll> ii;
typedef vector <ii> vii;
void printVct(vi &v){
for (ll i=0; i<sz(v); i++){
cout<<v[i]<<" ";
}
cout<<endl;
}
ll i,j,k,z,c;
void goToAnyNeighbourWithColor(ll color, ll setColor){
if (i == 2){
set_instruction({c, i, j, k, z}, setColor, 'W');
}
else if (j == 2){
set_instruction({c, i, j, k, z}, setColor, 'S');
}
else if (k == 2){
set_instruction({c, i, j, k, z}, setColor, 'E');
}
else if (z == 2){
set_instruction({c, i, j, k, z}, setColor, 'N');
}
}
bool goToNeighbourColorPriority(vi p, vi setColor){
for (ll x = 0; x<sz(p); x++){
if (i == p[x]){
set_instruction({c, i, j, k, z}, setColor[x], 'W');
}
else if (j == p[x]){
set_instruction({c, i, j, k, z}, setColor[x], 'S');
}
else if (k == p[x]){
set_instruction({c, i, j, k, z}, setColor[x], 'E');
}
else if (z == p[x]){
set_instruction({c, i, j, k, z}, setColor[x], 'N');
}
else{
continue;
}
return true;
}
return false;
}
void program_pulibot()
{
for (c = 0; c<=4; c++){
for (i = -2; i<=4; i++){
for (j =-2; j<=4; j++){
for (k = -2; k<=4; k++){
for (z = -2; z<=4; z++){
if (c == 3){
goToNeighbourColorPriority({3,4,1,2}, {4,0,0,0});
}
else if (c == 4){
goToNeighbourColorPriority({3,4,1,2}, {4,0,0,0});
}
else if (i == 1 || j == 1 || k == 1 || z == 1){
if (i == -2 && z == -2){
if (!goToNeighbourColorPriority({3}, {2}))
set_instruction({c, i, j, k, z}, 1, 'T');
}
else{
goToNeighbourColorPriority({3,2,1}, {1,1,0});
}
}
else{
if (k == -2 && j == -2){
goToAnyNeighbourWithColor(2, 1);
}
else if (k == 0){
set_instruction({c, i, j, k, z}, 2, 'E');
}
else if (j == 0){
set_instruction({c, i, j, k, z}, 2, 'S');
}
else{
goToAnyNeighbourWithColor(2,3);
}
}
}
}
}
}
}
}
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |