結果

問題 No.606 カラフルタイル
ユーザー ikdikd
提出日時 2017-12-06 00:28:43
言語 D
(dmd 2.106.1)
結果
RE  
実行時間 -
コード長 818 bytes
コンパイル時間 1,332 ms
コンパイル使用メモリ 142,232 KB
実行使用メモリ 7,364 KB
最終ジャッジ日時 2023-09-03 17:13:27
合計ジャッジ時間 4,102 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 RE -
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 RE -
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 7 ms
4,376 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 50 ms
4,588 KB
testcase_17 AC 77 ms
6,148 KB
testcase_18 AC 53 ms
4,900 KB
testcase_19 AC 51 ms
6,344 KB
testcase_20 AC 80 ms
7,176 KB
testcase_21 AC 53 ms
4,776 KB
testcase_22 RE -
testcase_23 AC 59 ms
5,140 KB
testcase_24 AC 74 ms
5,328 KB
testcase_25 AC 72 ms
5,848 KB
testcase_26 AC 82 ms
7,364 KB
testcase_27 AC 80 ms
6,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

  long n; int 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]=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