Muscardinus
테트로미노 본문
728x90
https://www.acmicpc.net/problem/14500
#include <iostream>
using namespace std;
int n, m;
int map[503][503];
const char block[19][4][5] = {
{
"1111",
"0000",
"0000",
"0000"
},
{
"1000",
"1000",
"1000",
"1000"
},
{
"1100",
"1100",
"0000",
"0000"
},
{
"1000",
"1000",
"1100",
"0000"
},
{
"0010",
"1110",
"0000",
"0000"
},
{
"1100",
"0100",
"0100",
"0000"
},
{
"1110",
"1000",
"0000",
"0000"
},
{
"0100",
"0100",
"1100",
"0000"
},
{
"1110",
"0010",
"0000",
"0000"
},
{
"1100",
"1000",
"1000",
"0000"
},
{
"1000",
"1110",
"0000",
"0000"
},
{
"1000",
"1100",
"0100",
"0000"
},
{
"0110",
"1100",
"0000",
"0000"
},
{
"0100",
"1100",
"1000",
"0000"
},
{
"1100",
"0110",
"0000",
"0000"
},
{
"1000",
"1100",
"1000",
"0000"
},
{
"0100",
"1110",
"0000",
"0000"
},
{
"0100",
"1100",
"0100",
"0000"
},
{
"1110",
"0100",
"0000",
"0000"
}
};
int get_count(int sy, int sx, int k) {
int ret = 0;
for (int y = 0; y < 4; y++) {
for (int x = 0; x < 4; x++) {
ret += (block[k][y][x] - '0') * map[sy + y][sx + x];
}
}
return ret;
}
int main() {
ios_base::sync_with_stdio(false);
cin >> n >> m;
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
cin >> map[i][j];
}
}
for (int y = n; y < n + 3; ++y) {
for (int x = 0; x < m + 3; ++x) {
map[y][x] = -100000;
}
}
for (int y = 0; y < n + 3; ++y) {
for (int x = m; x < m + 3; ++x) {
map[y][x] = -100000;
}
}
int ret = 0;
for (int y = 0; y < n; y++) {
for (int x = 0; x < m; x++) {
for (int k = 0; k < 19; k++) {
int candi = get_count(y, x, k);
if (ret < candi) ret = candi;
}
}
}
cout << ret<<"\n";
return 0;
}
728x90
Comments