結果

問題 No.606 カラフルタイル
ユーザー ikdikd
提出日時 2017-12-06 00:26:23
言語 D
(dmd 2.106.1)
結果
RE  
実行時間 -
コード長 822 bytes
コンパイル時間 1,751 ms
コンパイル使用メモリ 141,772 KB
実行使用メモリ 6,844 KB
最終ジャッジ日時 2023-09-03 17:13:12
合計ジャッジ時間 4,569 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,384 KB
testcase_03 RE -
testcase_04 AC 1 ms
4,384 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 RE -
testcase_08 AC 1 ms
4,384 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,384 KB
testcase_12 AC 1 ms
4,384 KB
testcase_13 AC 7 ms
4,384 KB
testcase_14 AC 1 ms
4,384 KB
testcase_15 AC 2 ms
4,384 KB
testcase_16 AC 57 ms
4,544 KB
testcase_17 AC 89 ms
6,252 KB
testcase_18 AC 59 ms
6,020 KB
testcase_19 AC 58 ms
4,792 KB
testcase_20 AC 89 ms
6,788 KB
testcase_21 AC 61 ms
4,748 KB
testcase_22 RE -
testcase_23 AC 68 ms
6,052 KB
testcase_24 AC 83 ms
6,320 KB
testcase_25 AC 84 ms
6,844 KB
testcase_26 AC 92 ms
6,000 KB
testcase_27 AC 92 ms
6,072 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

void main(){
  import std.stdio, std.string, std.conv, std.algorithm;

  int n, k, q; rd(n, k, q);
  auto a=new char[](q), b=new int[](q), c=new int[](q);
  foreach(i; 0..q){
    rd(a[i], b[i], c[i]);
    b[i]--; c[i]--;
  }

  auto cnt=new long[](k);
  auto used=new bool[][](2, n);
  auto num=new long[](2);
  foreach_reverse(i; 0..q){
    auto j=(a[i]=='R'?0:1);
    if(used[j][b[i]]) continue;
    used[j][b[i]]=true;
    cnt[c[i]]+=(n-num[j^1]);
    num[j]++;
  }

  cnt[0]=to!long(n)*n-reduce!"a+b"(cnt[1..$]);
  writefln("%(%s\n%)", cnt);
}

void rd(T...)(ref T x){
  import std.stdio, std.string, std.conv;
  auto l=readln.split;
  assert(l.length==x.length);
  foreach(i, ref e; x){
    e=l[i].to!(typeof(e));
  }
}
void wr(T...)(T x){
  import std.stdio;
  foreach(e; x) stderr.write(e, " ");
  stderr.writeln;
}
0