Submission #2152583


Source Code Expand

Copy
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<(n);i++)
#define loop(i,a,n) for(i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int h,w;

bool in(int x, int y){
  if(1<=x && x<h-1 && 1<=y && y<w-1) return true;
  else return false;
}

int main(void) {
  int i,j,k;
  int n;
  cin>>h>>w>>n;
  map<pii,int> mp;
  int d[3]={-1,0,1};
  rep(i,n){
    int a,b;
    cin>>a>>b;
    a--,b--;
    rep(j,3)rep(k,3)
      if(in(a+d[j],b+d[k]))mp[pii(a+d[j],b+d[k])]++;
  }

  vector<ll> ans(10,0);
  i=0;
  for(auto itr = mp.begin(); itr != mp.end(); ++itr){
    ans[itr->second]++;
  }

  ll sum=0;
  rep(i,10)sum+=ans[i];
  
  ans[0]=(ll)(h-2)*(w-2)-sum;

  rep(i,10)
    cout<<ans[i]<<endl;
}

Submission Info

Submission Time
Task D - すぬけ君の塗り絵 / Snuke's Coloring
User rika0384
Language C++14 (GCC 5.4.1)
Score 400
Code Size 1262 Byte
Status
Exec Time 431 ms
Memory 56576 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0
All 400 / 400 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 196 ms 6400 KB
02.txt 369 ms 41216 KB
03.txt 48 ms 3328 KB
04.txt 1 ms 256 KB
05.txt 158 ms 18944 KB
06.txt 156 ms 18944 KB
07.txt 378 ms 56448 KB
08.txt 378 ms 56576 KB
09.txt 398 ms 56448 KB
10.txt 1 ms 256 KB
11.txt 357 ms 38528 KB
12.txt 411 ms 56320 KB
13.txt 2 ms 256 KB
14.txt 431 ms 46592 KB
15.txt 386 ms 38656 KB
empty.txt 1 ms 256 KB
sample_01.txt 1 ms 256 KB
sample_02.txt 1 ms 256 KB
sample_03.txt 1 ms 256 KB