This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "robot.h"
#include<bits/stdc++.h>
using namespace std;
using ll = int;
const ll blk = 6;
const ll bk = 7;
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,6)
#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] = 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) if(b!=0) add_instruction({0,-2,0,b,-2},3,'S');
Al(a) Al(b) if(b!=0) add_instruction({0,-2,b,0,-2},4,'E');
Al(a) Al(b) add_instruction({b,-2,a,7,-2},1,'E');
Al(a) Al(b) add_instruction({b,-2,7,a,-2},1,'S');
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)]);
}
}
}
# | 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... |