# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1017878 | tmarcinkevicius | 로봇 대회 (IOI23_robot) | C++17 | 122 ms | 5860 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#include "robot.h"
typedef pair<int, int> pii;
#define f first
#define s second
#define all(x) (x).begin(), (x).end()
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;
}
}
}
}
}
}
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |