# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
694965 | minhcool | Navigation 2 (JOI21_navigation2) | C++17 | 0 ms | 200 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 namespace std;
//#define int long long
#define fi first
#define se second
#define pb push_back
#define mp make_pair
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;
const int N = 3e5 + 5;
const int oo = 1e18 + 7, mod = 1e9 + 7;
int n, a[N];
void Anna(int N, int K, vector<int> r, vector<int> c){
for(int i = 0; i < N; i++){
for(int j = 0; j < N; j++){
int temp = ((i % 3) * 3 + (j % 3));
if(temp == 7){
SetFlag(i, j, 1);
continue;
}
else if(temp == 8){
SetFlag(i, j, 2);
continue;
}
else{
int pos1 = r[temp], pos2 = c[temp];
int diff1 = r[temp] - i;
int diff2 = c[temp] - j;
if(diff1 <= -2) SetFlag(i, j, 5);
else if(diff1 >= 2) SetFlag(i, j, 4);
else if(diff2 <= -2) SetFlag(i, j, 3);
else if(diff2 >= 2) SetFlag(i, j, 2);
else SetFlag(i, j, 6 + (diff1 + 1) * 3 + diff2 + 1);
}
}
}
}
/*
signed main(){
ios_base::sync_with_stdio(0);
int t;
cin >> t;
while(t--) process();
}*/
#include "Bruno.h"
#include<bits/stdc++.h>
using namespace std;
//#define int long long
#define fi first
#define se second
#define pb push_back
#define mp make_pair
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;
const int N = 3e5 + 5;
const int oo = 1e18 + 7, mod = 1e9 + 7;
vector<int> Bruno(int K, vector<int> values){
vector<int> dirs;
dirs.resize(K);
int pos = -1;
for(int i = 0; i < 9; i++){
if(values[i] == 1){
pos = i;
break;
}
}
int pos1 = (pos / 3) - 1, pos2 = (pos % 3) - 1;
for(int i = 1; i < 3; i++){
for(int j = 0; j < 2; j++){
int pos3 = pos1 + i, pos4 = pos2 + j;
while(pos3 >= 2) pos3 -= 3;
while(pos4 >= 2) pos4 -= 3;
int posi = ((pos3 + 1) * 3 + (pos4 + 1));
int x = values[posi] - 1;
if(x <= 5) dirs[pos] = x - 2;
else{
int pos5 = pos3 + ((x - 6) / 3) - 1;
int pos6 = pos4 + ((x - 6) % 3) - 1;
if(pos6 > 0) dirs[pos] = 0;
else if(pos6 < 0) dirs[pos] = 1;
else if(pos5 > 0) dirs[pos] = 2;
else if(pos5 < 0) dirs[pos] = 3;
else dirs[pos] = 4;
}
}
}
return dirs;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |