Submission #1995447


Source Code Expand

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  
  ll h, w;
  int n;
  cin >> h >> w >> n;

  map<pii, int> mp;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    for (int j = 0; j < 3 && a - j >= 1; j++) {
      for (int k = 0; k < 3 && b - k >= 1; k++) {
        mp[pii(a - j, b - k)]++;
      }
    }
  }

  vector<ll> ans(10);
  ll all = (h - 2) * (w - 2);
  for (auto i : mp) {
    pii p = i.first;
    if (p.first >= 1 && p.first <= h - 2 && p.second >= 1 && p.second <= w - 2) {
      ans[i.second]++;
      all--;
    }
  }
  ans[0] = all;

  for (int i = 0; i < 10; i++) {
    cout << ans[i] << endl;
  }

  return 0;
}

Submission Info

Submission Time
Task D - Snuke's Coloring
User legosuke
Language C++14 (GCC 5.4.1)
Score 400
Code Size 802 Byte
Status AC
Exec Time 367 ms
Memory 56576 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 161 ms 6528 KB
02.txt AC 317 ms 41216 KB
03.txt AC 41 ms 3328 KB
04.txt AC 1 ms 256 KB
05.txt AC 272 ms 37760 KB
06.txt AC 230 ms 37632 KB
07.txt AC 318 ms 56448 KB
08.txt AC 322 ms 56576 KB
09.txt AC 320 ms 56576 KB
10.txt AC 1 ms 256 KB
11.txt AC 310 ms 38528 KB
12.txt AC 361 ms 56320 KB
13.txt AC 2 ms 256 KB
14.txt AC 367 ms 46720 KB
15.txt AC 328 ms 38656 KB
empty.txt AC 1 ms 256 KB
sample_01.txt AC 1 ms 256 KB
sample_02.txt AC 1 ms 256 KB
sample_03.txt AC 1 ms 256 KB