Submission #1241538

#TimeUsernameProblemLanguageResultExecution timeMemory
1241538mychecksedadRobot Contest (IOI23_robot)C++17
9 / 100
67 ms5788 KiB
#include "robot.h"
#include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define pii pair<int,int>
#define ff first
#define ss second
#define pb push_back

char lt = 'W';
char rt = 'E';
char up = 'N';
char down = 'S';
char T = 'T';
char stay = 'H';

// left down right up

vi all = {0, -1, -2, 1};
vi non_zero = {-1, -2, 1};
vi zero = {0};
vi border = {-2};
vi block = {-1};
vi closed = {-1, -2};
vi two = {2};
vi one = {1};

map<vi, bool> vis;

void add(int col, vi tp, vi tp2, vi tp3, vi tp4, int res_col, char res){
  for(int x: tp){
    for(int y: tp2){
      for(int z: tp3){
        for(int tt: tp4){
          vi X = {col, x, y, z, tt};
          if(vis[X]) continue;
          set_instruction(X, res_col, res);
          vis[X] = true;
        }
      }
    }
  }
}

void go_color(int col, int goo, int res){
  vi other;
  vi go = {goo};
  for(int j = -2; j <= 3; ++j) if(j != goo) other.pb(j);
  add(col, go, other, other, other, res, lt);
  add(col, other, go, other, other, res, down);
  add(col, other, other, go, other, res, rt);
  add(col, other, other, other, go, res, up);


  add(col, go, go, other, other, res, lt);
  add(col, go, other, go, other, res, lt);
  add(col, go, other, other, go, res, lt);

  add(col, go, go, other, other, res, lt);
  add(col, other, go, go, other, res, rt);
  add(col, other, go, other, go, res, down);

  add(col, go, other, go, other, res, lt);
  add(col, other, go, go, other, res, down);
  add(col, other, other, go, go, res, rt);

  add(col, go, other, go, go, res, lt);
  add(col, other, go, go, go, res, down);
  add(col, go, go, other, go, res, lt);
  add(col, go, go, go, other, res, lt);
}

void stuck(int col, int go){
  vi st = {-2, -1, 3};
  add(col, two, st, st, st, go, lt);
  add(col, st, two, st, st, go, down);
  add(col, st, st, two, st, go, rt);
  add(col, st, st, st, two, go, up);
}

void program_pulibot(){
  // vi one = {1};

  vi all_but_two = {-2, -1, 0, 1, 3};
  vi some = {-2, -1, 0, 3};


  add(2, border, one, some, border, 1, T);
  add(2, border, some, one, border, 1, T);

  add(0, two, border, border, all_but_two, 1, lt);
  add(0, all_but_two, border, border, two, 1, up);

  add(2, one, two, some, some, 1, down);
  add(2, one, some, two, some, 1, rt);
  add(2, one, some, some, two, 1, up);
  add(2, two, one, some, some, 1, lt);
  add(2, some, one, two, some, 1, rt);
  add(2, some, one, some, two, 1, up);
  add(2, two, some, one, some, 1, lt);
  add(2, some, two, one, some, 1, down);
  add(2, some, some, one, two, 1, up);
  add(2, two, some, some, one, 1, lt);
  add(2, some, two, some, one, 1, down);
  add(2, some, some, two, one, 1, rt); 


  go_color(0, 0, 2);
  go_color(2, 0, 2);
  stuck(0, 3);
  stuck(2, 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...