제출 #1214052

#제출 시각아이디문제언어결과실행 시간메모리
1214052Nelt로봇 대회 (IOI23_robot)C++20
컴파일 에러
0 ms0 KiB
#include "robot.h"
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll int
#define endl "\n"
using namespace std;
using namespace __gnu_pbds;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T, typename key = less<T>>
using ordered_set = tree<T, null_type, key, rb_tree_tag, tree_order_statistics_node_update>;

void program_pulibot()
{
    auto move = [&](ll x) -> char
    {
        if (x == 2) return 'W';
        if (x == 3) return 'S';
        if (x == 4) return 'E';
        return 'N';
    };

    ll v[] = {-2, -1, 0, 1, 2, 3, 4, 5};
    for (ll s0 : v)
    for (ll s1 : v)
    for (ll s2 : v)
    for (ll s3 : v)
    for (ll s4 : v)
    {
        ll S[5] = {s0, s1, s2, s3, s4};

        if (s0 == 0)
        {
            bool ok = 0;
            for (ll d = 0; d < 4; d++)
            {
                if (S[d + 1] == 0)
                {
                    set_instruction(S, 2 + d, move(2 + d));
                    ok = 1;
                    break;
                }
            }
            if (ok) continue;

            if (s2 == -2 && s3 == -2)
            {
                set_instruction(S, 1, 'T');
                continue;
            }

            for (ll d = 0; d < 4; d++)
            {
                ll opp = 2 + (d ^ 1);
                if (S[d + 1] == opp)
                {
                    set_instruction(S, 1, move(2 + (d ^ 1)));
                    ok = 1;
                    break;
                }
            }
            if (ok) continue;
        }

        if (s0 >= 2 && s0 <= 5)
        {
            set_instruction(S, 1, move(s0));
            continue;
        }

        set_instruction(S, 0, 'H');
    }
}

컴파일 시 표준 에러 (stderr) 메시지

robot.cpp: In function 'void program_pulibot()':
robot.cpp:40:37: error: could not convert '(int*)(& S)' from 'int*' to 'std::vector<int>'
   40 |                     set_instruction(S, 2 + d, move(2 + d));
      |                                     ^
      |                                     |
      |                                     int*
robot.cpp:49:33: error: could not convert '(int*)(& S)' from 'int*' to 'std::vector<int>'
   49 |                 set_instruction(S, 1, 'T');
      |                                 ^
      |                                 |
      |                                 int*
robot.cpp:58:37: error: could not convert '(int*)(& S)' from 'int*' to 'std::vector<int>'
   58 |                     set_instruction(S, 1, move(2 + (d ^ 1)));
      |                                     ^
      |                                     |
      |                                     int*
robot.cpp:68:29: error: could not convert '(int*)(& S)' from 'int*' to 'std::vector<int>'
   68 |             set_instruction(S, 1, move(s0));
      |                             ^
      |                             |
      |                             int*
robot.cpp:72:25: error: could not convert '(int*)(& S)' from 'int*' to 'std::vector<int>'
   72 |         set_instruction(S, 0, 'H');
      |                         ^
      |                         |
      |                         int*