Submission #1169844

#TimeUsernameProblemLanguageResultExecution timeMemory
1169844lightonRobot Contest (IOI23_robot)C++20
71 / 100
71 ms5976 KiB
#include "robot.h" #include<bits/stdc++.h> #define pb push_back #define all(v) v.begin(),v.end() #define forf(i,s,e) for(int i = s; i<=e; i++) #define forb(i,s,e) for(int i = s; i>=e; i--) #define idx(i,v) lower_bound(all(v),i)-v.begin() #define comp(v) v.erase(unique(all(v)),v.end()) #define sz(v) (int)v.size() #define fs first #define se second #define SP << " " << #define LN << "\n" #define IO cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false); using namespace std; typedef long long ll; ll inf = 1e18; set<array<int,5> > S; string dir = "WSEN"; void program_pulibot() { forf(now,0,6) forf(w,-2,6) forf(s,-2,6) forf(e,-2,6) forf(n,-2,6){ vector<int> ch; if(now == 0){ if (w == 1) ch.pb(0); if (s == 1) ch.pb(1); if (e == 1) ch.pb(2); if (n == 1) ch.pb(3); if(sz(ch)){ set_instruction({now,w,s,e,n},ch[0]+3,dir[ch[0]]); } else{ if (w == 2) ch.pb(0); if (s == 2) ch.pb(1); if (e == 2) ch.pb(2); if (n == 2) ch.pb(3); if(sz(ch)) set_instruction({now,w,s,e,n},0,dir[ch[0]]); else set_instruction({now,w,s,e,n},2,'H'); } } if(now == 2){ if(w==1 || s== 1 || e== 1 || n==1){ if (w == 0) ch.pb(0); if (s == 0) ch.pb(1); if (e == 0) ch.pb(2); if (n == 0) ch.pb(3); if(sz(ch)) set_instruction({now,w,s,e,n},1,dir[ch[0]]); else set_instruction({now,w,s,e,n},1,'H'); continue; } if(s == -2 && e == -2){ if (w == 2) ch.pb(0); if (s == 2) ch.pb(1); if (e == 2) ch.pb(2); if (n == 2) ch.pb(3); if(sz(ch)) {set_instruction({now,w,s,e,n},1,dir[ch[0]]); continue;} } if (w == 5) ch.pb(0); if (s == 6) ch.pb(1); if (e == 3) ch.pb(2); if (n == 4) ch.pb(3); if(sz(ch)) set_instruction({now,w,s,e,n},2,dir[ch[0]]); else set_instruction({now,w,s,e,n},1,'H'); } if(now == 1){ if(w==1 || s== 1 || e== 1 || n==1){ //clear if (w == 5) ch.pb(0); if (s == 6) ch.pb(1); if (e == 3) ch.pb(2); if (n == 4) ch.pb(3); if(sz(ch)) set_instruction({now,w,s,e,n},1,dir[ch[0]]); else{ if (w == 2) ch.pb(0); if (s == 2) ch.pb(1); if (e == 2) ch.pb(2); if (n == 2) ch.pb(3); if(sz(ch)) set_instruction({now,w,s,e,n},1,dir[ch[0]]); else set_instruction({now,w,s,e,n},1,'T'); } continue; } //extend if (w == 0) ch.pb(0); if (s == 0) ch.pb(1); if (e == 0) ch.pb(2); if (n == 0) ch.pb(3); if(sz(ch)){ set_instruction({now,w,s,e,n},1,dir[ch[0]]); } else set_instruction({now,w,s,e,n},0,'H'); } if(now >= 3) { if(w==2 || s== 2 || e== 2 || n==2) set_instruction({now,w,s,e,n},2,'H'); else{ //clear if (w == 5) ch.pb(0); if (s == 6) ch.pb(1); if (e == 3) ch.pb(2); if (n == 4) ch.pb(3); if(sz(ch)) set_instruction({now,w,s,e,n},now,dir[ch[0]]); else set_instruction({now,w,s,e,n},0,dir[now-3]); } } } }
#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...