Submission #1688597
Source Code Expand
#include<bits/stdc++.h> using namespace std; #define REP(i,s,n) for(int i=s;i<n;++i) #define rep(i,n) REP(i,0,n) #define SORT(c) sort((c).begin(),(c).end()) #define IINF INT_MAX #define LLINF LLONG_MAX typedef long long ll; typedef pair<int, int> ii; int main(){ ll h, w, n; cin >> h >> w >> n; vector<ll> a(n), b(n); rep(i, n){ cin >> a[i] >> b[i]; a[i]--; b[i]--; } map<ii, int> mp; rep(i, n){ for(int j = -1; j <= 1; j++){ for(int k = -1; k <= 1; k++){ ll na = a[i] + j; ll nb = b[i] + k; if(na < 1 || h - 1 <= na || nb < 1 || w - 1 <= nb) continue; mp[make_pair(na, nb)]++; } } } vector<ll> ans(10, 0); for(auto it : mp){ ans[it.second]++; } ans[0] = (h-2)*(w-2) - mp.size(); rep(i, 10) cout << ans[i] << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Snuke's Coloring |
User | letter |
Language | C++14 (GCC 5.4.1) |
Score | 400 |
Code Size | 870 Byte |
Status | AC |
Exec Time | 447 ms |
Memory | 58112 KB |
Judge Result
Set Name | Sample | All | ||
---|---|---|---|---|
Score / Max Score | 0 / 0 | 400 / 400 | ||
Status | AC |
|
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 | 184 ms | 7936 KB |
02.txt | AC | 351 ms | 42752 KB |
03.txt | AC | 46 ms | 3712 KB |
04.txt | AC | 1 ms | 256 KB |
05.txt | AC | 154 ms | 20608 KB |
06.txt | AC | 166 ms | 20608 KB |
07.txt | AC | 367 ms | 57984 KB |
08.txt | AC | 394 ms | 58112 KB |
09.txt | AC | 389 ms | 58112 KB |
10.txt | AC | 1 ms | 256 KB |
11.txt | AC | 351 ms | 40064 KB |
12.txt | AC | 421 ms | 57856 KB |
13.txt | AC | 2 ms | 256 KB |
14.txt | AC | 447 ms | 48256 KB |
15.txt | AC | 382 ms | 40192 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 |