Submission #842200

#TimeUsernameProblemLanguageResultExecution timeMemory
842200aintaRobot Contest (IOI23_robot)C++17
44 / 100
501 ms8784 KiB
#include "robot.h" #include <bits/stdc++.h> using namespace std; #define rng(i,a,b) for(int i=int(a);i<=int(b);i++) #define rep(i,b) rng(i,0,b-1) #define gnr(i,b,a) for(int i=int(b);i>=int(a);i--) #define per(i,b) gnr(i,b-1,0) #define pb push_back #define eb emplace_back #define fi first #define se second #define bg begin() #define ed end() #define all(x) x.bg,x.ed #define si(x) int(x.size()) template<class t> using vc=vector<t>; template<class t> using vvc=vc<vc<t>>; typedef long long ll; using pii=pair<int,int>; using vi=vc<int>; using uint=unsigned; using ull=unsigned long long; using pil=pair<int,ll>; using pli=pair<ll,int>; using pll=pair<ll,ll>; using t3=tuple<int,int,int>; vi get_info(int a){ if(a==0)return {0,0,0}; if(a>=2){ a-=2; return {a%3, (a%6)/3, a/6}; } return {-1,-1,-1}; } int get_parent(vi T){ rep(i,4){ if(2<=T[i]){ if(get_info(T[i])[2])return i; } } return -1; } int from_v(vi Z){ return (Z[0] + Z[1]*3 + Z[2]*6)+2; } int get_ch(int a, vi T){ auto vv = get_info(a); vi Ch; rep(i,4){ if(T[i]==0) return i; if(T[i]>=2){ auto v = get_info(T[i]); if(v[1]!=vv[1] && (vv[0]+1)%3==v[0]){ return i; } } } return -1; } void program_pulibot() { rng(i,0,14){ rng(j,-2,14){ rng(k,-2,14){ rng(l,-2,14){ rng(m,-2,14){ vi T={j,k,l,m}; if(m==-2 && j==-2){ // start if(i==0){ int c = from_v({0,1,1}); int nt = get_ch(c,T); if(nt>=0){ set_instruction({i,j,k,l,m}, c, "WSEN"[nt]); } } else{ if(j==1||k==1||l==1||m==1){ set_instruction({i,j,k,l,m}, 1, 'T'); } else{ int nt = get_ch(i,T); if(nt>=0){ set_instruction({i,j,k,l,m}, i, "WSEN"[nt]); } else{ if(i<2)continue; auto v = get_info(i); int c =from_v({v[0],!v[1],1}); int nt = get_ch(c,T); if(nt>=0){ set_instruction({i,j,k,l,m}, c, "WSEN"[nt]); } } } } } else if(k==-2 && l==-2){ // end if(i)continue; int nt = get_parent(T); if(nt>=0) set_instruction({i,j,k,l,m}, 1, "WSEN"[nt]); } else{ if(j==1||k==1||l==1||m==1){ int nt = get_parent(T); if(nt>=0) set_instruction({i,j,k,l,m}, 1, "WSEN"[nt]); } else{ if(i==0){ int x = get_parent(T); if(x<0)continue; if(T[x]<2)continue; auto v = get_info(T[x]); set_instruction({i,j,k,l,m}, from_v({(v[0]+1)%3, v[1],0}), "WSEN"[x]); } else{ int x = get_parent(T); if(x<0)continue; auto v = get_info(i); auto vv = get_info(T[x]); int c = from_v({v[0],vv[1],1}); int ch = get_ch(c,T); if(i<2)continue; if(ch>=0){ set_instruction({i,j,k,l,m}, c, "WSEN"[ch]); } else{ int x = get_parent(T); if(x<0)continue; set_instruction({i,j,k,l,m}, from_v({v[0],vv[1],0}), "WSEN"[x]); } } } } } } } } } }
#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...