#include "mars.h"
#include<bits/stdc++.h>
using namespace std;
#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 = 45;
const int oo = 1e18 + 7, mod = 1e9 + 7;
vector<ii> route[N][N];
int cnt[N][N][N];
ii save[N][N][N][105];// cell (i, j) at phase k, the h-th bit will save the value of what node
void prep(int n){// preparing the route for (i, j)
// in order to get 36, we don't need the SA the path
for(int i = 0; i < (2 * n + 1); i++){
for(int j = 0; j < (2 * n + 1); j++){
route[i][j].clear();
for(int k = 0; k < (2 * n + 1); k++) cnt[i][j][k] = 0;
}
}
for(int i = 0; i < (2 * n + 1); i++){
for(int j = 0; j < (2 * n + 1); j++){
for(int k = 0; k < n; k++){
route[i][j].pb({i - 2 * min(k, i / 2), j - 2 * min(k, j / 2)});
}
int itr = 0;
for(auto it : route[i][j]){
//cout << i << " " << j << " " << it.fi << " " << it.se << " " << itr << "\n";
save[it.fi][it.se][itr][cnt[it.fi][it.se][itr]] = {i, j};
cnt[it.fi][it.se][itr]++;
itr++;
}
}
}
}
int val[N][N];
void ff(int i, int j, int n){
//cout << i << " " << j << "\n";
if(i < 0 || j < 0 || i > (2 * n + 1) || j > (2 * n + 1) || !val[i][j]) return;
val[i][j] = 0;
ff(i + 1, j, n);
ff(i - 1, j, n);
ff(i, j - 1, n);
ff(i, j + 1, n);
}
string process(vector<vector<string>> a, int i, int j, int k, int n){
if(!(i + j + k)){
prep(n);
}
//cout << "OK\n";
for(int ii = 0; ii <= 2; ii++){
for(int jj = 0; jj <= 2; jj++){
for(int kk = 0; kk < cnt[i + ii][j + jj][k]; kk++){
int x = save[i + ii][j + jj][k][kk].fi, y = save[i + ii][j + jj][k][kk].se;
val[x][y] = a[ii][jj][kk] - '0';
//cout << i << " " << j << " " << k << " " << x << " " << y << " " << val[x][y] << "\n";
}
}
}
if(k == n - 1){
//exit(0);
int ans = 0;
for(int i = 0; i < (2 * n + 1); i++){
for(int j = 0; j < (2 * n + 1); j++){
//cout << "OK " << i << " " << j << " " << val[i][j] << "\n";
if(!val[i][j]) continue;
ans++;
ff(i, j, n);
}
}
//cout << ans << "\n";
string temp;
for(int kk = 0; kk < 100; kk++) temp += '0';
for(int kk = 0; kk < 20; kk++) if(ans & (1LL << kk)) temp[kk] = '1';
return temp;
}
else{
string temp;
for(int kk = 0; kk < 100; kk++) temp += '0';
for(int kk = 0; kk < cnt[i][j][k + 1]; kk++){
int x = save[i][j][k + 1][kk].fi, y = save[i][j][k + 1][kk].se;
temp[kk] = char(48 + val[x][y]);
}
return temp;
}
}
Compilation message
mars.cpp:16:21: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
16 | const int oo = 1e18 + 7, mod = 1e9 + 7;
| ~~~~~^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
456 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
456 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
456 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
456 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
456 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
456 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
456 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
456 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
456 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
456 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |