結果
問題 | No.606 カラフルタイル |
ユーザー |
![]() |
提出日時 | 2017-12-06 00:30:43 |
言語 | D (dmd 2.109.1) |
結果 |
RE
|
実行時間 | - |
コード長 | 819 bytes |
コンパイル時間 | 802 ms |
コンパイル使用メモリ | 102,800 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-12 22:48:54 |
合計ジャッジ時間 | 3,107 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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..$]);foreach(e; cnt) writeln(e);}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;}