結果

問題 No.11 カードマッチ
ユーザー nanae
提出日時 2017-03-04 05:26:47
言語 D
(dmd 2.109.1)
結果
AC  
実行時間 9 ms / 5,000 ms
コード長 664 bytes
コンパイル時間 794 ms
コンパイル使用メモリ 125,300 KB
実行使用メモリ 11,340 KB
最終ジャッジ日時 2024-06-12 07:11:41
合計ジャッジ時間 1,511 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

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