Submission #1301062

#TimeUsernameProblemLanguageResultExecution timeMemory
1301062khoavn2008Robot Contest (IOI23_robot)C++17
Compilation error
0 ms0 KiB
#include "robot.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define FOR(i,l,r) for(int i = (l), _r = (r); i <= _r; i++)
#define FORNG(i,r,l) for(int i = (r), _l = (l); i >= _l; i--)
#define REP(i,r) for(int i = 0, _r = (r); i < _r; i++)
#define endl '\n'
#define fi first
#define se second
#define pb push_back
#define size(v) ((ll)(v).size())
#define all(v) (v).begin(),(v).end()
#define MASK(x) (1LL << (x))
#define BIT(x,i) (((x) >> (i)) & 1)
const ll MOD = 1e9 + 7, N = 2e5 + 36, LOG = 18;
const ll INF = 1e18 + 36;
#define MAXCOLOR 6
#define WALL -2
#define BLOCK -1
#define EMPTY 0
#define PATH 1
#define U 2
#define D 3
#define L 4
#define R 5
#define BLOCKPATH 6
int rev(int x){
    if(x == U)return D;
    if(x == D)return U;
    if(x == L)return R;
    if(x == R)return L;
    return 36;
}
/*
    4
  1 0 3
    2
    N
  W 0 E
    S

    R->D->L->U
*/
void program_pulibot(){
    FOR(CUR,-2,MAXCOLOR)FOR(W,-2,MAXCOLOR)FOR(S,-2,MAXCOLOR)FOR(E,-2,MAXCOLOR)FOR(N,-2,MAXCOLOR){
        if(CUR == EMPTY){
            if(W == WALL && N == WALL)set_instruction({CUR, W, S, E, N}, U, 'H');
            else if(E == WALL && S == WALL)set_instruction({CUR, W, S, E, N}, PATH, 'H');
            else if(W == R)set_instruction({CUR, W, S, E, N}, L, 'W');
            else if(N == D)set_instruction({CUR, W, S, E, N}, U, 'N');
            else if(E == L)set_instruction({CUR, W, S, E, N}, R, 'E');
            else if(S == U)set_instruction({CUR, W, S, E, N}, D, 'S');
        }
        if(CUR == PATH){
            int cnt = 1 * (W == PATH) + 1 * (N == PATH) + 1 * (S == PATH) + 1 * (E == PATH);
            else if(cnt <= 1 && W == WALL && N == WALL)set_instruction({CUR, W, S, E, N}, PATH, 'T');
            else if(cnt <= 1 && W == R)set_instruction({CUR, W, S, E, N}, PATH, 'W');
            else if(cnt <= 1 && S == U)set_instruction({CUR, W, S, E, N}, PATH, 'S');
            else if(cnt <= 1 && E == L)set_instruction({CUR, W, S, E, N}, PATH, 'E');
            else if(cnt <= 1 && N == D)set_instruction({CUR, W, S, E, N}, PATH, 'N');
            else{
                if(W == PATH)set_instruction({CUR, W, S, E, N}, BLOCKPATH, 'W');
                else if(S == PATH)set_instruction({CUR, W, S, E, N}, BLOCKPATH, 'S');
                else if(E == PATH)set_instruction({CUR, W, S, E, N}, BLOCKPATH, 'E');
                else if(N == PATH)set_instruction({CUR, W, S, E, N}, BLOCKPATH, 'N');
            }
        }
        if(CUR == U){
            if(N == PATH)set_instruction({CUR, W, S, E, N}, PATH, 'H');
            else if(E == EMPTY || E == L)set_instruction({CUR, W, S, E, N}, R, 'E');
            else if(S == EMPTY || S == U)set_instruction({CUR, W, S, E, N}, D, 'S');
            else if(W == EMPTY || W == R)set_instruction({CUR, W, S, E, N}, L, 'W');
            else if(N == EMPTY || N == D)set_instruction({CUR, W, S, E, N}, U, 'N');
        }
        if(CUR == R){
            if(E == PATH)set_instruction({CUR, W, S, E, N}, PATH, 'H');
            else if(S == EMPTY || S == U)set_instruction({CUR, W, S, E, N}, D, 'S');
            else if(W == EMPTY || W == R)set_instruction({CUR, W, S, E, N}, L, 'W');
            else if(N == EMPTY || N == D)set_instruction({CUR, W, S, E, N}, U, 'N');
            else if(E == EMPTY || E == L)set_instruction({CUR, W, S, E, N}, R, 'E');
        }
        if(CUR == D){
            if(S == PATH)set_instruction({CUR, W, S, E, N}, PATH, 'H');
            else if(W == EMPTY || W == R)set_instruction({CUR, W, S, E, N}, L, 'W');
            else if(N == EMPTY || N == D)set_instruction({CUR, W, S, E, N}, U, 'N');
            else if(E == EMPTY || E == L)set_instruction({CUR, W, S, E, N}, R, 'E');
            else if(S == EMPTY || S == U)set_instruction({CUR, W, S, E, N}, D, 'S');
        }
        if(CUR == L){
            if(W == PATH)set_instruction({CUR, W, S, E, N}, PATH, 'H');
            else if(N == EMPTY || N == D)set_instruction({CUR, W, S, E, N}, U, 'N');
            else if(E == EMPTY || E == L)set_instruction({CUR, W, S, E, N}, R, 'E');
            else if(S == EMPTY || S == U)set_instruction({CUR, W, S, E, N}, D, 'S');
            else if(W == EMPTY || W == R)set_instruction({CUR, W, S, E, N}, L, 'W');
        }
    }
}

Compilation message (stderr)

robot.cpp: In function 'void program_pulibot()':
robot.cpp:58:13: error: expected '}' before 'else'
   58 |             else if(cnt <= 1 && W == WALL && N == WALL)set_instruction({CUR, W, S, E, N}, PATH, 'T');
      |             ^~~~
robot.cpp:56:24: note: to match this '{'
   56 |         if(CUR == PATH){
      |                        ^
robot.cpp:58:21: error: 'cnt' was not declared in this scope; did you mean 'int'?
   58 |             else if(cnt <= 1 && W == WALL && N == WALL)set_instruction({CUR, W, S, E, N}, PATH, 'T');
      |                     ^~~
      |                     int
robot.cpp:70:12: error: 'CUR' was not declared in this scope
   70 |         if(CUR == U){
      |            ^~~
robot.cpp:71:48: error: 'W' was not declared in this scope
   71 |             if(N == PATH)set_instruction({CUR, W, S, E, N}, PATH, 'H');
      |                                                ^
robot.cpp:71:51: error: 'S' was not declared in this scope
   71 |             if(N == PATH)set_instruction({CUR, W, S, E, N}, PATH, 'H');
      |                                                   ^
robot.cpp:71:54: error: 'E' was not declared in this scope
   71 |             if(N == PATH)set_instruction({CUR, W, S, E, N}, PATH, 'H');
      |                                                      ^
robot.cpp:71:41: error: could not convert '{CUR, <expression error>, <expression error>, <expression error>, N}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
   71 |             if(N == PATH)set_instruction({CUR, W, S, E, N}, PATH, 'H');
      |                          ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                         |
      |                                         <brace-enclosed initializer list>
robot.cpp:72:21: error: 'E' was not declared in this scope
   72 |             else if(E == EMPTY || E == L)set_instruction({CUR, W, S, E, N}, R, 'E');
      |                     ^
robot.cpp:72:64: error: 'W' was not declared in this scope
   72 |             else if(E == EMPTY || E == L)set_instruction({CUR, W, S, E, N}, R, 'E');
      |                                                                ^
robot.cpp:72:67: error: 'S' was not declared in this scope
   72 |             else if(E == EMPTY || E == L)set_instruction({CUR, W, S, E, N}, R, 'E');
      |                                                                   ^
robot.cpp:72:57: error: could not convert '{CUR, <expression error>, <expression error>, E, N}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
   72 |             else if(E == EMPTY || E == L)set_instruction({CUR, W, S, E, N}, R, 'E');
      |                                          ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                         |
      |                                                         <brace-enclosed initializer list>
robot.cpp:73:21: error: 'S' was not declared in this scope
   73 |             else if(S == EMPTY || S == U)set_instruction({CUR, W, S, E, N}, D, 'S');
      |                     ^
robot.cpp:73:64: error: 'W' was not declared in this scope
   73 |             else if(S == EMPTY || S == U)set_instruction({CUR, W, S, E, N}, D, 'S');
      |                                                                ^
robot.cpp:73:57: error: could not convert '{CUR, <expression error>, S, E, N}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
   73 |             else if(S == EMPTY || S == U)set_instruction({CUR, W, S, E, N}, D, 'S');
      |                                          ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                         |
      |                                                         <brace-enclosed initializer list>
robot.cpp:74:21: error: 'W' was not declared in this scope
   74 |             else if(W == EMPTY || W == R)set_instruction({CUR, W, S, E, N}, L, 'W');
      |                     ^
robot.cpp:74:57: error: could not convert '{CUR, W, S, E, N}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
   74 |             else if(W == EMPTY || W == R)set_instruction({CUR, W, S, E, N}, L, 'W');
      |                                          ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                         |
      |                                                         <brace-enclosed initializer list>
robot.cpp:75:57: error: could not convert '{CUR, W, S, E, N}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
   75 |             else if(N == EMPTY || N == D)set_instruction({CUR, W, S, E, N}, U, 'N');
      |                                          ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                         |
      |                                                         <brace-enclosed initializer list>
robot.cpp:77:12: error: 'CUR' was not declared in this scope
   77 |         if(CUR == R){
      |            ^~~
robot.cpp:78:16: error: 'E' was not declared in this scope
   78 |             if(E == PATH)set_instruction({CUR, W, S, E, N}, PATH, 'H');
      |                ^
robot.cpp:78:48: error: 'W' was not declared in this scope
   78 |             if(E == PATH)set_instruction({CUR, W, S, E, N}, PATH, 'H');
      |                                                ^
robot.cpp:78:51: error: 'S' was not declared in this scope
   78 |             if(E == PATH)set_instruction({CUR, W, S, E, N}, PATH, 'H');
      |                                                   ^
robot.cpp:78:41: error: could not convert '{CUR, <expression error>, <expression error>, E, N}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
   78 |             if(E == PATH)set_instruction({CUR, W, S, E, N}, PATH, 'H');
      |                          ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                         |
      |                                         <brace-enclosed initializer list>
robot.cpp:79:21: error: 'S' was not declared in this scope
   79 |             else if(S == EMPTY || S == U)set_instruction({CUR, W, S, E, N}, D, 'S');
      |                     ^
robot.cpp:79:64: error: 'W' was not declared in this scope
   79 |             else if(S == EMPTY || S == U)set_instruction({CUR, W, S, E, N}, D, 'S');
      |                                                                ^
robot.cpp:79:57: error: could not convert '{CUR, <expression error>, S, E, N}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
   79 |             else if(S == EMPTY || S == U)set_instruction({CUR, W, S, E, N}, D, 'S');
      |                                          ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                         |
      |                                                         <brace-enclosed initializer list>
robot.cpp:80:21: error: 'W' was not declared in this scope
   80 |             else if(W == EMPTY || W == R)set_instruction({CUR, W, S, E, N}, L, 'W');
      |                     ^
robot.cpp:80:57: error: could not convert '{CUR, W, S, E, N}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
   80 |             else if(W == EMPTY || W == R)set_instruction({CUR, W, S, E, N}, L, 'W');
      |                                          ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                         |
      |                                                         <brace-enclosed initializer list>
robot.cpp:81:57: error: could not convert '{CUR, W, S, E, N}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
   81 |             else if(N == EMPTY || N == D)set_instruction({CUR, W, S, E, N}, U, 'N');
      |                                          ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                         |
      |                                                         <brace-enclosed initializer list>
robot.cpp:82:57: error: could not convert '{CUR, W, S, E, N}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
   82 |             else if(E == EMPTY || E == L)set_instruction({CUR, W, S, E, N}, R, 'E');
      |                                          ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                         |
      |                                                         <brace-enclosed initializer list>
robot.cpp:84:12: error: 'CUR' was not declared in this scope
   84 |         if(CUR == D){
      |            ^~~
robot.cpp:85:16: error: 'S' was not declared in this scope
   85 |             if(S == PATH)set_instruction({CUR, W, S, E, N}, PATH, 'H');
      |                ^
robot.cpp:85:48: error: 'W' was not declared in this scope
   85 |             if(S == PATH)set_instruction({CUR, W, S, E, N}, PATH, 'H');
      |                                                ^
robot.cpp:85:54: error: 'E' was not declared in this scope
   85 |             if(S == PATH)set_instruction({CUR, W, S, E, N}, PATH, 'H');
      |                                                      ^
robot.cpp:85:41: error: could not convert '{CUR, <expression error>, S, <expression error>, N}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
   85 |             if(S == PATH)set_instruction({CUR, W, S, E, N}, PATH, 'H');
      |                          ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                         |
      |                                         <brace-enclosed initializer list>
robot.cpp:86:21: error: 'W' was not declared in this scope
   86 |             else if(W == EMPTY || W == R)set_instruction({CUR, W, S, E, N}, L, 'W');
      |                     ^
robot.cpp:86:70: error: 'E' was not declared in this scope
   86 |             else if(W == EMPTY || W == R)set_instruction({CUR, W, S, E, N}, L, 'W');
      |                                                                      ^
robot.cpp:86:57: error: could not convert '{CUR, W, S, <expression error>, N}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
   86 |             else if(W == EMPTY || W == R)set_instruction({CUR, W, S, E, N}, L, 'W');
      |                                          ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                         |
      |                                                         <brace-enclosed initializer list>
robot.cpp:87:70: error: 'E' was not declared in this scope
   87 |             else if(N == EMPTY || N == D)set_instruction({CUR, W, S, E, N}, U, 'N');
      |                                                                      ^
robot.cpp:87:57: error: could not convert '{CUR, W, S, <expression error>, N}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
   87 |             else if(N == EMPTY || N == D)set_instruction({CUR, W, S, E, N}, U, 'N');
      |                                          ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                         |
      |                                                         <brace-enclosed initializer list>
robot.cpp:88:21: error: 'E' was not declared in this scope
   88 |             else if(E == EMPTY || E == L)set_instruction({CUR, W, S, E, N}, R, 'E');
      |                     ^
robot.cpp:88:57: error: could not convert '{CUR, W, S, E, N}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
   88 |             else if(E == EMPTY || E == L)set_instruction({CUR, W, S, E, N}, R, 'E');
      |                                          ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                         |
      |                                                         <brace-enclosed initializer list>
robot.cpp:89:57: error: could not convert '{CUR, W, S, E, N}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
   89 |             else if(S == EMPTY || S == U)set_instruction({CUR, W, S, E, N}, D, 'S');
      |                                          ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                         |
      |                                                         <brace-enclosed initializer list>
robot.cpp:91:12: error: 'CUR' was not declared in this scope
   91 |         if(CUR == L){
      |            ^~~
robot.cpp:92:16: error: 'W' was not declared in this scope
   92 |             if(W == PATH)set_instruction({CUR, W, S, E, N}, PATH, 'H');
      |                ^
robot.cpp:92:51: error: 'S' was not declared in this scope
   92 |             if(W == PATH)set_instruction({CUR, W, S, E, N}, PATH, 'H');
      |                                                   ^
robot.cpp:92:54: error: 'E' was not declared in this scope
   92 |             if(W == PATH)set_instruction({CUR, W, S, E, N}, PATH, 'H');
      |                                                      ^
robot.cpp:92:41: error: could not convert '{CUR, W, <expression error>, <expression error>, N}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
   92 |             if(W == PATH)set_instruction({CUR, W, S, E, N}, PATH, 'H');
      |                          ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                         |
      |                                         <brace-enclosed initializer list>
robot.cpp:93:67: error: 'S' was not declared in this scope
   93 |             else if(N == EMPTY || N == D)set_instruction({CUR, W, S, E, N}, U, 'N');
      |                                                                   ^
robot.cpp:93:70: error: 'E' was not declared in this scope
   93 |             else if(N == EMPTY || N == D)set_instruction({CUR, W, S, E, N}, U, 'N');
      |                                                                      ^
robot.cpp:93:57: error: could not convert '{CUR, W, <expression error>, <expression error>, N}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
   93 |             else if(N == EMPTY || N == D)set_instruction({CUR, W, S, E, N}, U, 'N');
      |                                          ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                         |
      |                                                         <brace-enclosed initializer list>
robot.cpp:94:21: error: 'E' was not declared in this scope
   94 |             else if(E == EMPTY || E == L)set_instruction({CUR, W, S, E, N}, R, 'E');
      |                     ^
robot.cpp:94:67: error: 'S' was not declared in this scope
   94 |             else if(E == EMPTY || E == L)set_instruction({CUR, W, S, E, N}, R, 'E');
      |                                                                   ^
robot.cpp:94:57: error: could not convert '{CUR, W, <expression error>, E, N}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
   94 |             else if(E == EMPTY || E == L)set_instruction({CUR, W, S, E, N}, R, 'E');
      |                                          ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                         |
      |                                                         <brace-enclosed initializer list>
robot.cpp:95:21: error: 'S' was not declared in this scope
   95 |             else if(S == EMPTY || S == U)set_instruction({CUR, W, S, E, N}, D, 'S');
      |                     ^
robot.cpp:95:57: error: could not convert '{CUR, W, S, E, N}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
   95 |             else if(S == EMPTY || S == U)set_instruction({CUR, W, S, E, N}, D, 'S');
      |                                          ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                         |
      |                                                         <brace-enclosed initializer list>
robot.cpp:96:57: error: could not convert '{CUR, W, S, E, N}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
   96 |             else if(W == EMPTY || W == R)set_instruction({CUR, W, S, E, N}, L, 'W');
      |                                          ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                         |
      |                                                         <brace-enclosed initializer list>
robot.cpp: At global scope:
robot.cpp:99:1: error: expected declaration before '}' token
   99 | }
      | ^