# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1037161 | hotboy2703 | Navigation 2 (JOI21_navigation2) | C++17 | 0 ms | 0 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 "Bruno.h"
#include<bits/stdc++.h>
using ll = long long;
using namespace std;
#define pll pair <ll,ll>
#define fi first
#define se second
#define sz(a) (ll((a).size()))
#define BIT(mask,i) (((mask) >> (i))&1)
#define MASK(i) (1LL << (i))
#define MP make_pair
std::vector<int> Bruno(int K, std::vector<int> value) {
vector <vector <ll > > val(3,vector <ll> (3));
for (ll i = 0;i < 9;i ++)val[i/3][i%3] = value[i];
vector <vector <ll> > type(3,vector<ll> (3));
for (ll i = 0;i < 3;i ++){
for (ll j = 0;j < 3;j ++){
if (val[i][j] == 14 && val[i][(j+1)%3] == 14){
for (ll i1 = 0;i1 < 3;i1 ++){
for (ll j1 = 0;j1 < 3;j1 ++){
ll x = (2 + (i1 - i) + 3)%3;
ll y = (1 + (j1 - j) + 3)%3;
type[i1][j1] = x * 3 + y;
}
}
}
}
}
// for (ll i = 0;i < 3;i ++){
// for (ll j = 0;j < 3;j ++)cout<<val[i][j]<<' ';
// cout<<'\n';
// }
vector <int> res(K);
for (ll i = 0;i < 3;i ++){
for (ll j = 0;j < 3;j ++){
if (type[i][j] < K){
ll ni,nj;
auto &ans = res[type[i][j]];
if (val[i][j] <= 9){
ni = i+(val[i][j]-1)/3-1;
nj = j+(val[i][j]-1)%3-1;
if (nj > 1)ans = 0;
else if (nj < 1)ans = 1;
else if (ni > 1)ans = 2;
else if (ni < 1)ans = 3;
else ans = 4;
// cout<<"SUS "<<ni<<' '<<nj<<' '<<ans<<endl;
}
else{
ans = val[i][j] - 10;
}
// cout<<i<<' '<<j<<' '<<type[i][j]<<' '<<ans<<endl;
}
}
}
return res;
}