結果
問題 |
No.606 カラフルタイル
|
ユーザー |
|
提出日時 | 2020-07-11 23:37:29 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 73 ms / 2,000 ms |
コード長 | 738 bytes |
コンパイル時間 | 2,120 ms |
コンパイル使用メモリ | 200,640 KB |
最終ジャッジ日時 | 2025-01-11 19:51:31 |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:9:25: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 9 | int n,k,q; scanf("%d%d%d",&n,&k,&q); | ~~~~~^~~~~~~~~~~~~~~~~~~ main.cpp:12:23: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 12 | rep(i,q) scanf(" %c%d%d",&type[i],&pos[i],&color[i]), pos[i]--, color[i]--; | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h> #define rep(i,n) for(int i=0;i<(n);i++) using namespace std; using lint=long long; int main(){ int n,k,q; scanf("%d%d%d",&n,&k,&q); vector<char> type(q); vector<int> pos(q),color(q); rep(i,q) scanf(" %c%d%d",&type[i],&pos[i],&color[i]), pos[i]--, color[i]--; vector<lint> ans(k); int rcnt=0,ccnt=0; set<int> R_used,C_used; for(int i=q-1;i>=0;i--){ if(type[i]=='R'){ if(R_used.count(pos[i])>0) continue; ans[color[i]]+=n-ccnt; rcnt++; R_used.emplace(pos[i]); } else{ if(C_used.count(pos[i])>0) continue; ans[color[i]]+=n-rcnt; ccnt++; C_used.emplace(pos[i]); } } ans[0]+=1LL*n*n-accumulate(ans.begin(),ans.end(),0LL); rep(i,k) printf("%lld\n",ans[i]); return 0; }