[Offer收割]编程练习赛40 register

Ended

Participants:189

Verdict:Accepted
Score:100 / 100
Submitted:2017-12-17 12:06:00

Lang:G++

Edit
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
#include <bits/stdc++.h>
using namespace std;
using LL = int64_t;
using LD = long double;
const LL INF = 0x3f3f3f3f;
const LL mod = 1e9 + 7;
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    vector<vector<int>> a(n);
    for (auto& i : a) {
        i.resize(m);
        for (auto& j : i) cin >> j;
    }
    auto check = [&](int x, int y) {
        int sum = a[x][y] + a[x][y + 1] + a[x][y + 2];
        int tmp = 0;
        for (int i = 1; i < 3; i++) {
            tmp = 0;
            for (int j = 0; j < 3; j++) tmp += a[x + i][y + j];
            if (tmp != sum) return 0;
        }
        for (int i = 0; i < 3; i++) {
            tmp = 0;
            for (int j = 0; j < 3; j++) tmp += a[x + j][y + i];
            if (tmp != sum) return 0;
        }
        tmp = 0;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX