제출 #847863

#제출 시각아이디문제언어결과실행 시간메모리
847863ALeonidou로봇 대회 (IOI23_robot)C++17
6 / 100
94 ms5816 KiB
#include "robot.h"
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

#define ll int
#define F first
#define S second
#define ld long double
#define sz(x) (ll)x.size()
#define MID ((l+r)/2)
#define pb push_back
#define dbg(x) cout<<#x<<": "<<x<<endl;

typedef vector <ll> vi;
typedef pair <ll,ll> ii;
typedef vector <ii> vii;

void printVct(vi &v){
    for (ll i=0; i<sz(v); i++){
        cout<<v[i]<<" ";
    }
    cout<<endl;
}

ll i,j,k,z,c;
void goToAnyNeighbourWithColor(ll color, ll setColor){
    if (i == 2){
        set_instruction({c, i, j, k, z}, setColor, 'W');
    }
    else if (j == 2){
        set_instruction({c, i, j, k, z}, setColor, 'S');
    }
    else if (k == 2){
        set_instruction({c, i, j, k, z}, setColor, 'E');
    }
    else if (z == 2){
        set_instruction({c, i, j, k, z}, setColor, 'N');
    }
}

void goToNeighbourColorPriority(vi p, vi setColor){
    for (ll x = 0; x<sz(p); x++){
        if (i == p[x]){
            set_instruction({c, i, j, k, z}, setColor[x], 'W');
        }
        else if (j == p[x]){
            set_instruction({c, i, j, k, z}, setColor[x], 'S');
        }
        else if (k == p[x]){
            set_instruction({c, i, j, k, z}, setColor[x], 'E');
        }
        else if (z == p[x]){
            set_instruction({c, i, j, k, z}, setColor[x], 'N');
        }
        else{
            continue;
        }
        break;
    }
}


void program_pulibot()
{
    for (c = 0; c<=3; c++){
        for (i = -2; i<=3; i++){
            for (j =-2; j<=3; j++){
                for (k = -2; k<=3; k++){
                    for (z = -2; z<=3; z++){
                        if (i == 1 || j == 1 || k == 1 || z == 1){
                            if (i == -2 && z == -2){
                                set_instruction({c, i, j, k, z}, 1, 'T');
                            }
                            else{
                                goToNeighbourColorPriority({3,2,1}, {1,1,0});
                            }
                        }
                        else{
                            if (k == -2 && j == -2){
                                goToAnyNeighbourWithColor(2, 1);
                            }
                            else if (k == 0){
                                set_instruction({c, i, j, k, z}, 2, 'E');
                            }
                            else if (j == 0){
                                set_instruction({c, i, j, k, z}, 2, 'S');
                            }
                            else{
                                goToAnyNeighbourWithColor(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...