Submission #1688570
Source Code Expand
#include<bits/stdc++.h>
using namespace std;
int a[100005]={0}, b[100005]={0};
int dx[9]={0,1,1,1,0,-1,-1,-1,0}, dy[9]={-1,-1,0,1,1,1,0,-1,0};
int main(){
long long int h, w, n;
cin >> h >> w >> n;
set<pair<int, int> > p;
for(int i=0;i<n;++i){
cin >> a[i] >> b[i];
p.insert(pair<int, int>(a[i], b[i]));
}
set<pair<int, int> > st[10];
for(int i=0;i<n;++i){
for(int j=0;j<9;++j){
int cx = a[i] + dx[j], cy = b[i] + dy[j];
if(cx > 1 && cx < h && cy > 1 && cy < w){
int cnt = 0;
for(int k=0;k<9;++k){
if(p.count(pair<int,int>(cx+dx[k], cy+dy[k])))cnt++;
}
st[cnt].insert(pair<int,int>(cx, cy));
}
}
}
long long int tmp = 0;
for(int i=1;i<10;++i)tmp += st[i].size();
cout << (h-2)*(w-2) - tmp << endl;
for(int i=1;i<10;++i){
cout << st[i].size() << endl;
}
return 0;
}
Submission Info
Submission Time |
|
Task |
D - Snuke's Coloring |
User |
nicklaw296 |
Language |
C++14 (GCC 5.4.1) |
Score |
400 |
Code Size |
1025 Byte |
Status |
AC |
Exec Time |
1196 ms |
Memory |
47872 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 |
955 ms |
10240 KB |
02.txt |
AC |
1100 ms |
36352 KB |
03.txt |
AC |
220 ms |
3840 KB |
04.txt |
AC |
1 ms |
256 KB |
05.txt |
AC |
481 ms |
19712 KB |
06.txt |
AC |
382 ms |
19712 KB |
07.txt |
AC |
748 ms |
47872 KB |
08.txt |
AC |
768 ms |
47872 KB |
09.txt |
AC |
777 ms |
47872 KB |
10.txt |
AC |
1 ms |
256 KB |
11.txt |
AC |
1130 ms |
34432 KB |
12.txt |
AC |
1022 ms |
47744 KB |
13.txt |
AC |
3 ms |
256 KB |
14.txt |
AC |
1196 ms |
40448 KB |
15.txt |
AC |
1137 ms |
34432 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 |