이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "robot.h"
#include<bits/stdc++.h>
using namespace std;
using ll = int;
const ll blk = 6;
const ll bk = 7;
const ll rm = 8;
const vector<ll> bls = {-2,-1,blk};
#define For(a,l,r) for(ll a = (l);a<=(r);a++)
#define Al(a) For(a,-2,8)
#define Bl(a) for(ll a : bls)
set<vector<int>> used;
void add_instruction(vector<int> S, int Z, char A){
if(used.count(S)) return;
used.insert(S);
set_instruction(S,Z,A);
}
void program_pulibot(){
string fn = "WSEN";
Al(a) Al(b) add_instruction({7,a,-2,-2,b},1,'T');
For(i,0,3) Al(a) Al(b) Al(c){
vector<ll> v(5,0);
v[0] = bk;
v[i+1] = blk;
v[(i+1)%4+1] = a;
v[(i+2)%4+1] = b;
v[(i+3)%4+1] = c;
add_instruction(v,bk,fn[i]);
v[0] = blk;
add_instruction(v,rm,fn[i]);
v[0] = rm;
add_instruction(v,rm,fn[i]);
}
For(i,0,3) Al(a) Al(b) Al(c){
vector<ll> v(5,0);
v[0] = blk;
v[i+1] = rm;
v[(i+1)%4+1] = a;
v[(i+2)%4+1] = b;
v[(i+3)%4+1] = c;
add_instruction(v,0,fn[i]);
v[i+1] = bk;
add_instruction(v,0,fn[i]);
v[0] = rm;
add_instruction(v,0,fn[i]);
v[i+1] = rm;
add_instruction(v,0,fn[i]);
}
For(i,0,3){
Al(a) Al(b) Al(c){
vector<ll> v(5,0);
v[0] = c;
v[((i+2)%4)+1] = i+2;
v[((i+0)%4)+1] = bk;
v[((i+1)%4)+1] = a;
v[((i+3)%4)+1] = b;
add_instruction(v,bk,fn[((i+2)%4)]);
v[((i+0)%4)+1] = a;
v[((i+1)%4)+1] = bk;
v[((i+3)%4)+1] = b;
add_instruction(v,bk,fn[((i+2)%4)]);
v[((i+0)%4)+1] = a;
v[((i+1)%4)+1] = b;
v[((i+3)%4)+1] = bk;
add_instruction(v,bk,fn[((i+2)%4)]);
}
Al(a) Al(b) Al(c){
add_instruction({bk,bk,a,b,c},1,fn[0]);
add_instruction({bk,a,bk,b,c},1,fn[1]);
add_instruction({bk,a,b,bk,c},1,fn[2]);
add_instruction({bk,a,b,c,bk},1,fn[3]);
}
}
Al(a) add_instruction({0,a,-2,-2,3},bk,'N');
Al(a) add_instruction({0,4,-2,-2,a},bk,'W');
Al(a) Al(b) add_instruction({b,-2,a,7,-2},bk,'H');
Al(a) Al(b) add_instruction({b,-2,7,a,-2},bk,'H');
For(i,0,3){
Al(a) Al(b) Al(c){
vector<ll> v(5,0);
v[0] = c;
v[((i+2)%4)+1] = i+2;
v[((i+1)%4)+1] = a;
v[((i+0)%4)+1] = 0;
v[((i+3)%4)+1] = b;
add_instruction(v,((i+0)%4)+2,fn[((i+0)%4)]);
}
Al(a) Al(b) Al(c){
vector<ll> v(5,0);
v[0] = c;
v[((i+2)%4)+1] = i+2;
v[((i+1)%4)+1] = a;
v[((i+0)%4)+1] = b;
add_instruction(v,((i+3)%4)+2,fn[((i+3)%4)]);
}
Al(a) Al(b) Al(c){
vector<ll> v(5,0);
v[0] = c;
v[((i+2)%4)+1] = i+2;
v[((i+1)%4)+1] = 0;
v[((i+0)%4)+1] = a;
v[((i+3)%4)+1] = b;
add_instruction(v,((i+1)%4)+2,fn[((i+1)%4)]);
}
Bl(a) Bl(b) Bl(c) Al(d){
vector<ll> v(5,0);
v[0] = d;
v[((i+2)%4)+1] = i+2;
v[((i+0)%4)+1] = a;
v[((i+1)%4)+1] = b;
v[((i+3)%4)+1] = c;
add_instruction(v,blk,fn[((i+2)%4)]);
}
}
Al(a) Al(c) Al(b) add_instruction({c,-2,0,b,-2},3,'S');
Al(a) Al(c) Al(b) add_instruction({c,-2,b,0,-2},4,'E');
}
# | 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... |