Submission #10209650


Source Code Expand

#include <iostream>
#include <string>
#include <cmath>
#include <set>
#include <utility>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <cstdio>
#include <cstring>

using namespace std;

constexpr long long mod = 1000000007;
constexpr double eps = 0.0000000001;

typedef long long ll;
typedef long long unsigned ull;

int main() {
    int n, h, w;
    ll c[10];
    cin >> h >> w >> n;
    for (int i = 0; i < 10; i++) c[i] = 0;
    c[0] = (ll)(h - 2) * (w - 2);
    vector<pair<int, int>> m(n);
    set<pair<int, int>> s;
    for (auto &e:m) {
        cin >> e.first >> e.second;
        for (int i = -2; i < 3; i++)
            for (int j = -2; j < 3; j++)
                if (e.first + i > 0 && e.first + i <= h && e.second + j > 0 && e.second + j < +w)
                    s.insert(make_pair(e.first + i, e.second + j));
    }
    sort(m.begin(), m.end());
    for (auto &e:s) {
        if (e.first + 2 > h || e.second + 2 > w) continue;
        int d = 0;
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                if (binary_search(m.begin(), m.end(), make_pair(e.first + i, e.second + j))) d++;
            }
        }
        c[d]++;
        c[0]--;
    }
    for(int i = 0;i < 10;i++) cout << c[i] << endl;
}

Submission Info

Submission Time
Task D - Snuke's Coloring
User linare
Language C++14 (GCC 5.4.1)
Score 400
Code Size 1373 Byte
Status AC
Exec Time 1717 ms
Memory 120192 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status AC
AC × 19
Set Name Test Cases
Sample
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, empty.txt, sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
01.txt AC 413 ms 5632 KB
02.txt AC 1111 ms 51712 KB
03.txt AC 113 ms 2816 KB
04.txt AC 1 ms 256 KB
05.txt AC 887 ms 71296 KB
06.txt AC 537 ms 47872 KB
07.txt AC 1532 ms 118144 KB
08.txt AC 1547 ms 120192 KB
09.txt AC 1540 ms 118272 KB
10.txt AC 1 ms 256 KB
11.txt AC 1032 ms 44800 KB
12.txt AC 1717 ms 116864 KB
13.txt AC 3 ms 256 KB
14.txt AC 1407 ms 69248 KB
15.txt AC 1068 ms 44672 KB
empty.txt AC 1 ms 256 KB
sample_01.txt AC 1 ms 256 KB
sample_02.txt AC 2 ms 256 KB
sample_03.txt AC 2 ms 256 KB