-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbj_14500.cpp
More file actions
67 lines (54 loc) · 1.62 KB
/
bj_14500.cpp
File metadata and controls
67 lines (54 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include <iostream>
using namespace std;
int tetris[500][500];
int calculate(int X, int Y);
int main() {
int N, M;
cin >> N >> M;
for(int i = 0; i<N; i++) {
for(int j = 0; j<M; j++) {
cin >> tetris[i][j];
}
}
int ver[19][4][2] = {
{{0,0}, {0,1}, {0,2}, {0, 3}},
{{0,0}, {1,0}, {2,0}, {3, 0}},
{{0,0}, {0,1}, {1,0}, {1, 1}},
{{0,0}, {1,0}, {2,0}, {2, 1}},
{{0,0}, {1,0}, {2,0}, {0, 1}},
{{0,0}, {0,1}, {0,2}, {1, 2}},
{{1,0}, {1,1}, {1,2}, {0, 2}},
{{0,1}, {1,1}, {2,1}, {2, 0}},
{{0,0}, {0,1}, {1,1}, {2, 1}},
{{0,0}, {1,0}, {1,1}, {1, 2}},
{{0,0}, {0,1}, {0,2}, {1, 0}},
{{0,0}, {0,1}, {0,2}, {1, 1}},
{{0,1}, {1,1}, {2,1}, {1, 0}},
{{0,0}, {1,0}, {1,1}, {2, 0}},
{{0,1}, {1,0}, {1,1}, {1, 2}},
{{0,0}, {1,0}, {1,1}, {2, 1}},
{{1, 1}, {0,1}, {0,2}, {1, 0}},
{{0,1}, {1,1}, {1,0}, {2, 0}},
{{0,0}, {0,1}, {1,1}, {1, 2}}
};
int m = 0;
// first test
for(int i = 0; i<N; i++) {
for(int j = 0; j<M; j++) {
for(int k = 0; k<19; k++) {
int s = 0;
for(int m = 0; m<4; m++) {
int x = i + ver[k][m][0];
int y = j + ver[k][m][1];
if(x >= N || y >= M) {
s = 0;
break;
}
s += tetris[x][y];
}
m = max(s, m);
}
}
}
cout << m << endl;
}