Submission #1017876

#TimeUsernameProblemLanguageResultExecution timeMemory
1017876tmarcinkeviciusRobot Contest (IOI23_robot)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
#include "robot.h"
typedef pair<int, int> pii;
#define f first
#define s second

const int maxColor = 4;

/*
    0 - unvisited
    1 - final
    2 - explore
    3 - bad way
    4 - bad way fix
*/
void program_pulibot()
{
    vector<int> S(5);

    vector<pair<int, char>> directions =
        {
            {3, 'E'}, {2, 'S'}, {1, 'W'}, {4, 'N'}};

    for (S[0] = 0; S[0] <= maxColor; S[0]++)
    {
        for (S[1] = -2; S[1] <= maxColor; S[1]++)
        {
            for (S[2] = -2; S[2] <= maxColor; S[2]++)
            {
                for (S[3] = -2; S[3] <= maxColor; S[3]++)
                {
                    for (S[4] = -2; S[4] <= maxColor; S[4]++)
                    {
                        if (S[0] == 4)
                        {
                            bool found = false;
                            for (auto p : directions)
                            {
                                if (S[p.f] == 3)
                                {
                                    set_instruction(S, 4, p.s);
                                    found = true;
                                    break;
                                }
                            }

                            if (found)
                                continue;

                            found = false;
                            for (auto p : directions)
                            {
                                if (S[p.f] == 4)
                                {
                                    set_instruction(S, 0, p.s);
                                    found = true;
                                    break;
                                }
                            }

                            if (found)
                                continue;

                            for (auto p : directions)
                            {
                                if (S[p.f] == 2)
                                {
                                    set_instruction(S, 1, p.s);
                                    found = true;
                                    break;
                                }
                            }

                            if (found)
                                continue;

                            if (S[1] == -2 && S[4] == -2)
                            {
                                set_instruction(S, 1, 'T');
                            }
                            continue;
                        }
                        if (S[0] == 3)
                        {
                            bool found = false;
                            reverse(all(directions));
                            for (auto p : directions)
                            {
                                if (S[p.f] == 3)
                                {
                                    set_instruction(S, 4, p.s);
                                    found = true;
                                    break;
                                }
                            }
                            reverse(all(directions));

                            if (found)
                                continue;

                            for (auto p : directions)
                            {
                                if (S[p.f] == 4)
                                {
                                    set_instruction(S, 0, p.s);
                                    found = true;
                                    break;
                                }
                            }

                            if (found)
                                continue;

                            if (S[1] == -2 && S[4] == -2)
                            {
                                set_instruction(S, 1, 'T');
                            }
                            continue;
                        }

                        bool found1 = false;
                        for (auto p : directions)
                        {
                            if (S[p.f] == 1)
                            {
                                found1 = true;
                                break;
                            }
                        }

                        if (found1)
                        {
                            bool found = false;
                            for (auto p : directions)
                            {
                                if (S[p.f] == 3)
                                {
                                    set_instruction(S, 4, p.s);
                                    found = true;
                                    break;
                                }
                            }

                            if (found)
                                continue;

                            if (S[1] == -2 && S[4] == -2)
                            {
                                set_instruction(S, 1, 'T');
                                continue;
                            }

                            for (auto p : directions)
                            {
                                if (S[p.f] == 2)
                                {
                                    set_instruction(S, 1, p.s);
                                    break;
                                }
                            }

                            continue;
                        }

                        if (S[0] == 0 || S[0] == 2)
                        {
                            if (S[2] == -2 && S[3] == -2)
                            {
                                for (auto p : directions)
                                {
                                    if (S[p.f] == 2)
                                    {
                                        set_instruction(S, 1, p.s);
                                        break;
                                    }
                                }
                                continue;
                            }
                            bool found = false;
                            for (auto p : directions)
                            {
                                if (S[p.f] == 0 && p.s != 'N' && p.s != 'W')
                                {
                                    set_instruction(S, 2, p.s);
                                    found = true;
                                    break;
                                }
                            }

                            if (found)
                                continue;

                            for (auto p : directions)
                            {
                                if (S[p.f] == 2)
                                {
                                    set_instruction(S, 3, p.s);
                                    break;
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}

Compilation message (stderr)

robot.cpp: In function 'void program_pulibot()':
robot.cpp:87:37: error: 'all' was not declared in this scope; did you mean 'std::filesystem::perms::all'?
   87 |                             reverse(all(directions));
      |                                     ^~~
      |                                     std::filesystem::perms::all
In file included from /usr/include/c++/10/filesystem:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:129,
                 from robot.cpp:1:
/usr/include/c++/10/bits/fs_fwd.h:148:7: note: 'std::filesystem::perms::all' declared here
  148 |       all  =  0777,
      |       ^~~