結果
| 問題 | No.606 カラフルタイル | 
| コンテスト | |
| ユーザー |  tnakao0123 | 
| 提出日時 | 2017-12-08 12:55:33 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 35 ms / 2,000 ms | 
| コード長 | 1,465 bytes | 
| コンパイル時間 | 832 ms | 
| コンパイル使用メモリ | 84,164 KB | 
| 実行使用メモリ | 5,760 KB | 
| 最終ジャッジ日時 | 2024-11-29 19:10:56 | 
| 合計ジャッジ時間 | 2,692 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 25 | 
コンパイルメッセージ
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;
}
            
            
            
        