| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1065712 | TheQuantiX | Simurgh (IOI17_simurgh) | C++17 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "books.h"
using namespace std;
using ll = long long;
constexpr ll INF = 1000000000000000000LL;
ll n, m, q, k, x, y, a, b, c;
map< pair< vector<int>, pair<int, int> >, ll > mp;
vector<int> perfect;
long long minimum_walk(vector<int> p, int s) {
ll num = 0;
bool fl = 1;
for (int i = 0; i < p.size(); i++) {
num += abs(i - p[i]);
if (i != p[i]) {
fl = 0;
}
if (fl) {
num += 2;
}
}
return num;
// for (int i = 0; i < p.size(); i++) {
// perfect.push_back(i);
// }
// deque< pair< vector<int>, pair<int, int> > > q;
// q.push_back({p, {s, -1}});
// mp[{p, {s, -1}}] = 0;
// while (!q.empty()) {
// auto [p, p2] = q[0];
// auto [s, carry] = p2;
// q.pop_front();
// // for (auto i : p) {
// // cout << i << ' ';
// // }
// // cout << endl;
// // cout << s << ' ' << carry << endl;
// if (p == perfect && s == 0 && carry == -1) {
// return mp[{p, {s, carry}}];
// }
// ll d = mp[{p, {s, carry}}];
// swap(carry, p[s]);
// if (!mp.count({p, {s, carry}})) {
// q.push_front({p, {s, carry}});
// mp[{p, {s, carry}}] = d;
// }
// swap(carry, p[s]);
// if (s > 0 && !mp.count({p, {s - 1, carry}})) {
// q.push_back({p, {s - 1, carry}});
// mp[{p, {s - 1, carry}}] = d + 1;
// }
// if (s < p.size() - 1 && !mp.count({p, {s + 1, carry}})) {
// q.push_back({p, {s + 1, carry}});
// mp[{p, {s + 1, carry}}] = d + 1;
// }
// }
}
