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 <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <vector>
using namespace std;
int c, w, s, e, n;
vector<int> get() {
return {c, w, s, e, n};
}
void final_route() {
c = 5;
for(w = -2; w <= 5; w++) {
for(s = -2; s <= 5; s++) {
for(e = -2; e <= 5; e++) {
for(n = -2; n <= 5; n++) {
if(s == -2 && e == -2) {
set_instruction(get(), 1, 'T');
continue;
}
if(w == 5) {
set_instruction(get(), 1, 'W');
continue;
}
if(s == 5) {
set_instruction(get(), 1, 'S');
continue;
}
if(e == 5) {
set_instruction(get(), 1, 'E');
continue;
}
if(n == 5) {
set_instruction(get(), 1, 'N');
continue;
}
}
}
}
}
}
void redefining_route() {
c = 0;
s = e = -2;
for(w = -2; w <= 5; w++) {
for(n = -2; n <= 5; n++) {
if(w > 0) {
set_instruction(get(), 5, 'W');
continue;
}
if(n > 0) {
set_instruction(get(), 5, 'N');
continue;
}
}
}
for(c = 1; c < 5; c++) {
for(w = -2; w <= 5; w++) {
for(s = -2; s <= 5; s++) {
for(e = -2; e <= 5; e++) {
for(n = -2; n <= 5; n++) {
if(w != 5 && s != 5 && e != 5 && n != 5)
continue;
if(w == -2 && n == -2) {
if(s == 5) {
set_instruction(get(), 1, 'S');
continue;
}
if(e == 5) {
set_instruction(get(), 1, 'E');
continue;
}
continue;
}
if(w > 0 && w != 5) {
set_instruction(get(), 5, 'W');
continue;
}
if(s > 0 && s != 5) {
set_instruction(get(), 5, 'S');
continue;
}
if(e > 0 && e != 5) {
set_instruction(get(), 5, 'E');
continue;
}
if(n > 0 && n != 5) {
set_instruction(get(), 5, 'N');
continue;
}
}
}
}
}
}
}
void finding_route() {
const string dir = "WSEN";
for(c = 0; c < 5; c++) {
for(w = -2; w < 5; w++) {
for(s = -2; s < 5; s++) {
for(e = -2; e < 5; e++) {
for(n = -2; n < 5; n++) {
if(s == -2 && e == -2)
continue;
bool is = 0;
for(int i = c; i < 4; i++) {
if(i == 0 && w) continue;
if(i == 1 && s) continue;
if(i == 2 && e) continue;
if(i == 3 && n) continue;
is = 1;
set_instruction(get(), i + 1, dir[i]);
break;
}
if(is) continue;
if(w > 0) {
set_instruction(get(), 0, 'W');
continue;
}
if(s > 0) {
set_instruction(get(), 0, 'S');
continue;
}
if(e > 0) {
set_instruction(get(), 0, 'E');
continue;
}
if(n > 0) {
set_instruction(get(), 0, 'N');
continue;
}
}
}
}
}
}
}
void program_pulibot() {
final_route();
redefining_route();
finding_route();
}
# | 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... |