提出 #983891


ソースコード 拡げる

#include <cstdio>
#include <map>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
map<P, int> m;

int main(){
    int N;
    ll H, W, a, b;
    scanf("%lld %lld %d", &H, &W, &N);
    for(int i = 0; i < N; i++){
        scanf("%lld %lld", &a, &b);
        for(int j = -1; j <= 1; j++){
            for(int k = -1; k <= 1; k++){
                ll cen_a = a + j;
                ll cen_b = b + k;
                if(cen_a <= 1 || cen_b <= 1 || cen_a >= H || cen_b >= W) continue;
                map<P, int>::iterator ite;
                ite = m.find(P(cen_a, cen_b));
                if(ite != m.end()) ite->second++;
                else m.insert(make_pair(P(cen_a, cen_b), 1));
            }
        }
    }
    ll res[10] = {0};
    ll sum = 0;
    map<P, int>::iterator ite;
    for(ite = m.begin(); ite != m.end(); ite++){
        res[ite->second]++;
        sum++;
    }
    res[0] = (H - 2) * (W - 2) - sum;
    for(int i = 0; i < 10; i++) printf("%lld\n", res[i]);
    return 0;
}

提出情報

提出日時
問題 D - すぬけ君の塗り絵
ユーザ setoyama1
言語 C++14 (GCC 5.4.1)
得点 400
コード長 1043 Byte
結果 AC
実行時間 486 ms
メモリ 56448 KiB

コンパイルエラー

./Main.cpp: In function ‘int main()’:
./Main.cpp:11:38: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld %lld %d", &H, &W, &N);
                                      ^
./Main.cpp:13:35: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld %lld", &a, &b);
                                   ^

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 400 / 400
結果 AC
AC × 16
セット名 テストケース
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
ケース名 結果 実行時間 メモリ
01.txt AC 173 ms 6400 KiB
02.txt AC 409 ms 41216 KiB
03.txt AC 48 ms 3328 KiB
04.txt AC 2 ms 256 KiB
05.txt AC 161 ms 18944 KiB
06.txt AC 151 ms 18944 KiB
07.txt AC 424 ms 56448 KiB
08.txt AC 425 ms 56448 KiB
09.txt AC 433 ms 56448 KiB
10.txt AC 2 ms 256 KiB
11.txt AC 401 ms 38528 KiB
12.txt AC 486 ms 56320 KiB
13.txt AC 3 ms 256 KiB
14.txt AC 454 ms 46592 KiB
15.txt AC 397 ms 38528 KiB
empty.txt AC 2 ms 256 KiB
sample_01.txt AC 2 ms 256 KiB
sample_02.txt AC 2 ms 256 KiB
sample_03.txt AC 2 ms 256 KiB