結果
| 問題 | No.606 カラフルタイル | 
| コンテスト | |
| ユーザー |  ikd | 
| 提出日時 | 2017-12-06 00:28:43 | 
| 言語 | D (dmd 2.109.1) | 
| 結果 | 
                                RE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 818 bytes | 
| コンパイル時間 | 1,821 ms | 
| コンパイル使用メモリ | 144,892 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-06-12 22:48:33 | 
| 合計ジャッジ時間 | 3,807 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 22 RE * 3 | 
ソースコード
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;
}
            
            
            
        