結果
| 問題 |
No.607 開通777年記念
|
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2017-12-08 13:57:25 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,465 bytes |
| コンパイル時間 | 609 ms |
| コンパイル使用メモリ | 83,664 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-29 19:12:02 |
| 合計ジャッジ時間 | 2,828 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | RE * 3 |
| other | WA * 4 RE * 6 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:57:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
57 | scanf("%d%d%d", &n, &k, &qn);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
main.cpp:61:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
61 | scanf("%s%d%d", sc, &qs[i].b, &qs[i].c);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
/* -*- coding: utf-8 -*-
*
* 606.cc: No.606 カラフルタイル - yukicoder
*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
using namespace std;
/* constant */
const int MAX_N = 100000;
const int MAX_K = 100000;
const int MAX_QN = 100000;
/* typedef */
typedef long long ll;
enum { ROW, COL };
struct Query {
int a, b, c;
Query() {}
Query(int _a, int _b, int _c): a(_a), b(_b), c(_c) {}
};
/* global variables */
Query qs[MAX_QN];
bool rused[MAX_N], cused[MAX_N];
ll cnts[MAX_K];
/* subroutines */
/* main */
int main() {
int n, k, qn;
scanf("%d%d%d", &n, &k, &qn);
for (int i = 0; i < qn; i++) {
char sc[2];
scanf("%s%d%d", sc, &qs[i].b, &qs[i].c);
qs[i].a = (sc[0] == 'R') ? ROW : COL;
qs[i].b--, qs[i].c--;
}
ll sum = 0;
int rc = n, cc = n;
for (int i = qn - 1; i >= 0; i--) {
Query &qi = qs[i];
if (qi.a == ROW) {
if (! rused[qi.b]) {
rused[qi.b] = true;
cnts[qi.c] += rc;
sum += rc;
cc--;
}
}
else {
if (! cused[qi.b]) {
cused[qi.b] = true;
cnts[qi.c] += cc;
sum += cc;
rc--;
}
}
}
cnts[0] += (ll)n * n - sum;
for (int i = 0; i < k; i++) printf("%lld\n", cnts[i]);
return 0;
}
tnakao0123