# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1037162 | hotboy2703 | Navigation 2 (JOI21_navigation2) | C++17 | 581 ms | 1828 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<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
void Anna(int N, int K, std::vector<int> R, std::vector<int> C) {
for (int r = 0; r < N; r++) {
for (int c = 0; c < N; c++) {
ll t = (r%3)*3+(c%3);
if (t>=K){
SetFlag(r,c,14);
}
else{
ll res = -1;
if (abs(R[t] - r) >= 2){
if (R[t] > r)res = 12;
else res = 13;
}
else if (abs(C[t] - c) >= 2){
if (C[t] > c)res = 10;
else res = 11;
}
else{
res = (R[t] - r + 1) * 3 + (C[t] - c + 1) + 1;
}
SetFlag(r,c,res);
}
}
}
}
#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;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |