Submission #842230

#TimeUsernameProblemLanguageResultExecution timeMemory
842230gs18115Robot Contest (IOI23_robot)C++17
100 / 100
125 ms6532 KiB
#include"robot.h" #include<iostream> #include<vector> #include<algorithm> #define ep emplace #define eb emplace_back #define fi first #define se second #define all(x) (x).begin(),(x).end() using namespace std; typedef long long ll; typedef pair<int,int>pi; typedef pair<ll,ll>pl; const int inf=1e9+7; const ll INF=1e18; #define SI set_instruction #define forn(i) for(int i=-2;i<=6;i++) const char H='H',W='W',S='S',E='E',N='N',T='T'; const int cw=3,cs=4,ce=5,cn=6; char findarrow(int a,int b,int c,int d,int e) { if(b==ce) return W; if(c==cn) return S; if(d==cw) return E; if(e==cs) return N; return H; } char findnum(int a,int b,int c,int d,int e,int num) { if(b==num) return W; if(c==num) return S; if(d==num) return E; if(e==num) return N; return H; } bool isstart(int a,int b,int c,int d,int e) { return b==-2&&e==-2; } bool isend(int a,int b,int c,int d,int e) { return c==-2&&d==-2; } int col(char c) { if(c==W) return cw; if(c==S) return cs; if(c==E) return ce; if(c==N) return cn; return -1; } char recol(int c) { if(c==cw) return W; if(c==cs) return S; if(c==ce) return E; if(c==cn) return N; return -1; } void program_pulibot() { forn(a)forn(b)forn(c)forn(d)forn(e) { int Z=0; char A=T; int arr=findarrow(a,b,c,d,e); int zer=findnum(a,b,c,d,e,0); int one=findnum(a,b,c,d,e,1); int two=findnum(a,b,c,d,e,2); bool stt=isstart(a,b,c,d,e); bool edd=isend(a,b,c,d,e); if(a>2&&edd) Z=1,A=two; else if(a==2&&one!=H&&zer!=H) Z=2,A=zer; else if(a==2&&one!=H) Z=1,A=H; else if(a==1&&arr!=H&&one!=H) Z=1,A=arr; else if(a>2&&two==H&&arr!=H) Z=a,A=arr; else if(a>2&&two==H) Z=0,A=recol(a); else if(a==1&&stt&&one!=H) Z=1,A=T; else if(a==1&&one!=H) Z=1,A=two; else if(a==0&&stt) Z=2,A=H; else if(a==2&&arr!=H) Z=2,A=arr; else if(a>2&&two!=H) Z=2,A=H; else if(a==1&&zer!=H) Z=1,A=zer; else if(a==2&&arr==H&&zer!=H) Z=1,A=zer; else if(a==0&&one!=H) Z=col(one),A=one; else if(a==0&&two!=H) Z=col(two),A=two; else if(a==1&&stt) Z=2,A=H; else if(a==1&&two!=H) Z=0,A=two; else if(a==2&&two!=H) Z=0,A=two; SI(vector<int>{a,b,c,d,e},Z,A); } return; }
#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...