結果

問題 No.11 カードマッチ
ユーザー nanaenanae
提出日時 2017-03-04 05:26:47
言語 D
(dmd 2.107.1)
結果
AC  
実行時間 10 ms / 5,000 ms
コード長 664 bytes
コンパイル時間 657 ms
コンパイル使用メモリ 109,580 KB
実行使用メモリ 11,492 KB
最終ジャッジ日時 2023-09-03 01:42:28
合計ジャッジ時間 1,807 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 4 ms
5,908 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 10 ms
11,492 KB
testcase_07 AC 4 ms
5,964 KB
testcase_08 AC 5 ms
6,720 KB
testcase_09 AC 9 ms
11,208 KB
testcase_10 AC 8 ms
10,384 KB
testcase_11 AC 7 ms
10,056 KB
testcase_12 AC 8 ms
10,020 KB
testcase_13 AC 6 ms
9,284 KB
testcase_14 AC 5 ms
5,944 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.stdio, std.string, std.conv, std.array, std.algorithm;
import std.uni, std.range, std.math, std.container, std.datetime;
import core.bitop;

immutable long MOD = 1_000_000_007;

void main(){
    char[] buf;
    auto W = readln.chomp.to!ulong;
    auto H = readln.chomp.to!ulong;
    auto N = readln.chomp.to!int;
    auto f_col = new int[](H.to!int);
    auto f_row = new int[](W.to!int);

    foreach(lp ; 0 .. N){
        readln(buf);
        auto rd = buf.split.to!(int[]);
        auto s = rd[0] - 1, k = rd[1] - 1;
        f_row[s] = 1;
        f_col[k] = 1;
    }

    auto ans = W * H - (W - f_row.sum) * (H - f_col.sum) - N;

    writeln(ans);
}
0