제출 #1069485

#제출 시각아이디문제언어결과실행 시간메모리
1069485vjudge1로봇 대회 (IOI23_robot)C++17
88 / 100
179 ms15468 KiB
#include "robot.h" #include <bits/stdc++.h> using namespace std; enum Stat { BOUND = 1, BLOCK = 2, EMPTY = 4, PATH = 8, BRIGHT = 16, UP = 32, DOWN = 64, LEFT = 128, RIGHT = 256, BUP = 512, BDOWN = 1024, BLEFT = 2048, // special ANY = 4095, ANP = ANY & ~(EMPTY | PATH | BUP | BDOWN | BLEFT | BRIGHT), BAD = BOUND | BLOCK, INIT = BAD | EMPTY, }; enum Col { Bound = -2, Block, Empty, Path, BRight, Up, Down, Left, Right, BUp, BDown, BLeft, }; #define OPEN(v,i)\ for (int v = -2; v <= 10; ++v) {\ if (!((S[i]>>(v+2))&1)) continue; #define CLOS(v,i)\ } set<array<int,5>> seen; void si(array<int,5> S, Col Z, char A, bool exc = false) { OPEN(a,0) OPEN(b,1) OPEN(c,2) OPEN(d,3) OPEN(e,4) if (exc && c == Bound && d == Bound) continue; if (seen.count({a,b,c,d,e})) continue; set_instruction({a,b,c,d,e},Z,A); seen.insert({a,b,c,d,e}); CLOS(e,4) CLOS(d,3) CLOS(c,2) CLOS(b,1) CLOS(a,0) } void program_pulibot() { // init si({EMPTY,BOUND,INIT,INIT,BOUND},Left,'H',true); // cont si({LEFT,ANP,ANY&~(EMPTY|UP),ANY,ANY},Down,'H'); si({DOWN,ANY,ANP,ANY&~(EMPTY|LEFT),ANY},Right,'H'); si({RIGHT,ANY,ANY,ANP,ANY&~(EMPTY|DOWN)},Up,'H'); si({UP,ANY&~(EMPTY|RIGHT),ANY,ANY,ANP},Left,'H'); // traverse si({LEFT,ANP,UP,ANY,ANY},Down,'S'); si({DOWN,ANY,ANP,LEFT,ANY},Right,'E'); si({RIGHT,ANY,ANY,ANP,DOWN},Up,'N'); si({UP,RIGHT,ANY,ANY,ANP},Left,'W'); // explore si({LEFT,ANP,EMPTY,ANY,ANY},Down,'S'); si({DOWN,ANY,ANP,EMPTY,ANY},Right,'E'); si({RIGHT,ANY,ANY,ANP,EMPTY},Up,'N'); si({UP,EMPTY,ANY,ANY,ANP},Left,'W'); // new si({EMPTY,ANY&~RIGHT,ANY&~UP,ANY&~LEFT,DOWN},Up,'N',true); si({EMPTY,RIGHT,ANY&~UP,ANY&~LEFT,ANY&~DOWN},Left,'W',true); si({EMPTY,ANY&~RIGHT,UP,ANY&~LEFT,ANY&~DOWN},Down,'S',true); si({EMPTY,ANY&~RIGHT,ANY&~UP,LEFT,ANY&~DOWN},Right,'E',true); // found si({EMPTY,ANY,BOUND,BOUND,ANY},BUp,'H'); // done si({ANY,PATH,BOUND,BOUND,ANY},Path,'T'); si({ANY,ANY,BOUND,BOUND,PATH},Path,'T'); // cont si({BLEFT,ANY,ANY&~(UP|BUP),ANY,ANY},BDown,'H'); si({BDOWN,ANY,ANY,ANY&~(LEFT|BLEFT),ANY},BRight,'H'); si({BRIGHT,ANY,ANY,ANY,ANY&~(DOWN|BDOWN)},BUp,'H'); si({BUP,ANY&~(RIGHT|BRIGHT),ANY,ANY,ANY},BLeft,'H'); // trash path init si({BLEFT,BOUND,BUP,ANY&~BLEFT,BOUND},Path,'S'); si({BDOWN,BOUND,ANY&~BUP,BLEFT,BOUND},Path,'E'); // trash path si({BLEFT,PATH,BUP,ANY&~BLEFT,ANY&~BDOWN},Path,'S'); si({BLEFT,ANY&~BRIGHT,BUP,PATH,ANY&~BDOWN},Path,'S'); si({BLEFT,ANY&~BRIGHT,BUP,ANY&~BLEFT,PATH},Path,'S'); si({BDOWN,PATH,ANY&~BUP,BLEFT,ANY&~BDOWN},Path,'E'); si({BDOWN,ANY&~BRIGHT,PATH,BLEFT,ANY&~BDOWN},Path,'E'); si({BDOWN,ANY&~BRIGHT,ANY&~BUP,BLEFT,PATH},Path,'E'); si({BRIGHT,PATH,ANY&~BUP,ANY&~BLEFT,BDOWN},Path,'N'); si({BRIGHT,ANY&~BRIGHT,PATH,ANY&~BLEFT,BDOWN},Path,'N'); si({BRIGHT,ANY&~BRIGHT,ANY&~BUP,PATH,BDOWN},Path,'N'); si({BUP,BRIGHT,PATH,ANY&~BLEFT,ANY&~BDOWN},Path,'W'); si({BUP,BRIGHT,ANY&~BUP,PATH,ANY&~BDOWN},Path,'W'); si({BUP,BRIGHT,ANY&~BUP,ANY&~BLEFT,PATH},Path,'W'); // trash empty si({BLEFT,ANY&~BRIGHT,BUP,ANY&~BLEFT,ANY&~BDOWN},Empty,'S'); si({BDOWN,ANY&~BRIGHT,ANY&~BUP,BLEFT,ANY&~BDOWN},Empty,'E'); si({BRIGHT,ANY&~BRIGHT,ANY&~BUP,ANY&~BLEFT,BDOWN},Empty,'N'); si({BUP,BRIGHT,ANY&~BUP,ANY&~BLEFT,ANY&~BDOWN},Empty,'W'); // travs si({BUP,BRIGHT,BUP,ANY,ANY},BLeft,'W'); si({BUP,BRIGHT,ANY&~BUP,BLEFT,ANY},BLeft,'W'); si({BUP,BRIGHT,ANY&~BUP,ANY&~BLEFT,BDOWN},BLeft,'W'); si({BLEFT,ANY&~BRIGHT,BUP,BLEFT,ANY},BDown,'S'); si({BLEFT,ANY&~BRIGHT,BUP,ANY&~BLEFT,BDOWN},BDown,'S'); si({BDOWN,ANY&~BRIGHT,ANY&~BUP,BLEFT,BDOWN},BRight,'E'); // trav fix si({BLEFT,ANY,UP,ANY,ANY},BDown,'S'); si({BDOWN,ANY,ANY,LEFT,ANY},BRight,'E'); si({BRIGHT,ANY,ANY,ANY,DOWN},BUp,'N'); si({BUP,RIGHT,ANY,ANY,ANY},BLeft,'W'); // fix si({LEFT,BRIGHT,ANY,ANY,ANY},BLeft,'H'); si({DOWN,ANY,BUP,ANY,ANY},BDown,'H'); si({RIGHT,ANY,ANY,BLEFT,ANY},BRight,'H'); si({UP,ANY,ANY,ANY,BDOWN},BUp,'H'); // // shrink good // si({CAND,ANY&~RIGHT,BOUND,BOUND,DOWN},Path,'N'); // si({CAND,RIGHT,BOUND,BOUND,ANY&~DOWN},Path,'W'); // // cont shrink // si({LEFT,EMPTY|PATH,ANY,ANY,ANY},Cand,'H'); // si({DOWN,ANY,EMPTY|PATH,ANY,ANY},Cand,'H'); // si({RIGHT,ANY,ANY,EMPTY|PATH,ANY},Cand,'H'); // si({UP,ANY,ANY,ANY,EMPTY|PATH},Cand,'H'); // // shrink cont // si({CAND,ANY&~RIGHT,ANY&~UP,ANY&~LEFT,DOWN},Path,'N',true); // si({CAND,RIGHT,ANY&~UP,ANY&~LEFT,ANY&~DOWN},Path,'W',true); // si({CAND,ANY&~RIGHT,UP,ANY&~LEFT,ANY&~DOWN},Path,'S',true); // si({CAND,ANY&~RIGHT,ANY&~UP,LEFT,ANY&~DOWN},Path,'E',true); // // check // si({CAND,RIGHT,UP,ANY,ANY},Left,'W',true); // si({CAND,RIGHT,ANY&~UP,LEFT,ANY},Left,'W',true); // si({CAND,RIGHT,ANY&~UP,ANY&~LEFT,DOWN},Left,'W',true); // si({CAND,ANY&~RIGHT,UP,LEFT,ANY},Down,'S',true); // si({CAND,ANY&~RIGHT,UP,ANY&~LEFT,DOWN},Down,'S',true); // si({CAND,ANY&~RIGHT,ANY&~UP,LEFT,DOWN},Right,'E',true); // // extend // si({LEFT,PATH,ANY,ANY,ANY},Path,'H'); // si({DOWN,ANY,PATH,ANY,ANY},Path,'H'); // si({RIGHT,ANY,ANY,PATH,ANY},Path,'H'); // si({UP,ANY,ANY,ANY,PATH},Path,'H'); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...