結果
| 問題 |
No.606 カラフルタイル
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-12-06 00:07:20 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,330 bytes |
| コンパイル時間 | 1,489 ms |
| コンパイル使用メモリ | 159,592 KB |
| 実行使用メモリ | 10,812 KB |
| 最終ジャッジ日時 | 2024-11-28 18:25:50 |
| 合計ジャッジ時間 | 3,122 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 4 WA * 21 |
コンパイルメッセージ
main.cpp: In function ‘void solve(int)’:
main.cpp:29:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
29 | scanf("%d%d%d", &n, &m, &Q);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~
main.cpp:37:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
37 | scanf("%s%d%d", s, &x, &y);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~
ソースコード
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
const int MM = 1e9 + 7;
const double eps = 1e-8;
const int MAXN = 2e5 + 10;
int n, m;
void prework(){
}
void read(){
}
int r[MAXN], c[MAXN], rt[MAXN], ct[MAXN];
int z[MAXN], X[MAXN], Y[MAXN];
int ans[MAXN], visr[MAXN], visc[MAXN];
void solve(int casi){
// cout << "Case #" << casi << ": ";
int Q;
scanf("%d%d%d", &n, &m, &Q);
for (int i = 1; i <= n; i++){
r[i] = 1, rt[i] = 0;
c[i] = 1, ct[i] = 0;
}
for (int i = 1; i <= Q; i++){
char s[10];
int x, y;
scanf("%s%d%d", s, &x, &y);
if (s[0] == 'R'){
r[x] = y;
rt[x] = i;
}
else{
c[x] = y;
ct[x] = i;
}
z[i] = s[0]=='R';
X[i] = x;
Y[i] = y;
}
for (int i = 1; i <= m; i++)
ans[i] = 0;
for (int i = 1; i <= n; i++)
visr[i] = visc[i] = 0;
int R = n, C = n;
for (int i = Q; i >= 1; i--){
if (z[i] == 1){
if (visr[X[i]])
;
else
ans[Y[i]] += C;
R--;
visr[X[i]] = 1;
}
else{
if (visc[X[i]])
;
else
ans[Y[i]] += R;
C--;
visc[X[i]] = 1;
}
}
for (int i = 1; i <= m; i++)
printf("%d\n", ans[i]);
}
void printans(){
}
int main(){
// std::ios::sync_with_stdio(false);
prework();
int T = 1;
// cin>>T;
for(int i = 1; i <= T; i++){
read();
solve(i);
printans();
}
return 0;
}