# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
398532 | fedoseevtimofey | Navigation 2 (JOI21_navigation2) | C++17 | 989 ms | 892 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "Anna.h"
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <iomanip>
#include <functional>
#include <cassert>
#include <bitset>
#include <chrono>
using namespace std;
void Anna(int n, int k, vector <int> R, vector <int> C) {
vector <pair <int, int>> d = {{-1, -1}, {-1, 0}, {-1, 1}, {0, -1}, {0, 0}, {0, 1}, {1, -1}, {1, 0}, {1, 1}};
assert(k == 7);
for (int r = 0; r < n; r++) {
for (int c = 0; c < n; c++) {
int id = (3 * r + c) % 9;
if (id == 8) {
SetFlag(r, c, 14);
} else if (id == 7) {
SetFlag(r, c, 1);
} else {
int val = 0;
if (C[id] >= c + 2) val = 0;
else if (C[id] <= c - 2) val = 1;
else if (R[id] >= r + 2) val = 2;
else if (R[id] <= r - 2) val = 3;
else {
for (int i = 0; i < (int)d.size(); ++i) {
if (r + d[i].first == R[id] && c + d[i].second == C[id]) {
/*if (r == 0 && c == 0 && id == 0) {
cout << "go " << d[i].first << ' ' << d[i].second << endl;
}*/
val = 4 + i;
}
}
}
SetFlag(r, c, val + 1);
}
}
}
}
#include "Bruno.h"
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <iomanip>
#include <functional>
#include <cassert>
#include <bitset>
#include <chrono>
using namespace std;
vector <int> Bruno(int k, vector <int> value) {
vector <pair <int, int>> d = {{-1, -1}, {-1, 0}, {-1, 1}, {0, -1}, {0, 0}, {0, 1}, {1, -1}, {1, 0}, {1, 1}};
vector <int> res(k, 0);
int dx, dy;
for (int i = 0; i < (int)value.size(); ++i) {
if (value[i] == 14) {
dx = d[i].first, dy = d[i].second;
}
}
for (int i = 0; i < (int)value.size(); ++i) {
int x = (8 + (3 * (d[i].first - dx) + (d[i].second - dy)) % 9) % 9;
if (x >= k) continue;
--value[i];
if (value[i] <= 3) {
res[x] = value[i];
} else {
int cx = d[i].first + d[value[i] - 4].first;
int cy = d[i].second + d[value[i] - 4].second;
//cout << x << ' ' << value[i] - 4 << ' ' << cx << ' ' << cy << endl;
if (cy > 0) res[x] = 0;
else if (cy < 0) res[x] = 1;
else if (cx > 0) res[x] = 2;
else if (cx < 0) res[x] = 3;
else res[x] = 4;
}
}
return res;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |