-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathntoj_1077.cpp
More file actions
61 lines (47 loc) · 1.24 KB
/
ntoj_1077.cpp
File metadata and controls
61 lines (47 loc) · 1.24 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
#include<bits/stdc++.h>
using namespace std;
int main() {
int height,width;
cin>>height>>width;
const int attack[7][5]={
{0,1,1,1,0},
{1,0,8,0,1},
{1,0,0,0,0},
{0,1,6,1,0},
{0,0,0,0,1},
{1,0,7,0,1},
{0,1,1,1,0},
};
int map[500][500];
for (int i=0;i<height;i++) {
for (int j=0;j<width;j++) {
cin>>map[i][j];
}
}
if (height<7||width<5) {
cout<<"GotoWC"<<"\n";
return 0;
}
vector<pair<int,pair<int,int>>> topLeft;
for (int y=0;y<height-7+1;y++) {
for (int x=0;x<width-5+1;x++) {
int xOffset=x;
int yOffset=y;
int damage=0;
for (int i=0;i<7;i++) {
for (int j=0;j<5;j++) {
damage+=map[i+yOffset][j+xOffset]*attack[i][j];
}
}
topLeft.push_back({damage,{y,x}});
}
}
pair<int,pair<int,int>> max(topLeft[0].first,{topLeft[0].second.first,topLeft[0].second.second});
for (const auto tL:topLeft) {
if (max.first>tL.first)
continue;
max=tL;
}
cout<<max.first<<"\n"<<max.second.first+4<<" "<<max.second.second+3<<"\n";
return 0;
}