結果
問題 | No.606 カラフルタイル |
ユーザー | FF256grhy |
提出日時 | 2017-11-28 15:26:21 |
言語 | C++14 (gcc 13.2.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 206 ms / 2,000 ms |
コード長 | 2,471 bytes |
コンパイル時間 | 1,455 ms |
コンパイル使用メモリ | 165,628 KB |
実行使用メモリ | 9,072 KB |
最終ジャッジ日時 | 2023-08-18 09:09:39 |
合計ジャッジ時間 | 5,721 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 4 ms
6,540 KB |
testcase_01 | AC | 3 ms
6,448 KB |
testcase_02 | AC | 3 ms
6,448 KB |
testcase_03 | AC | 3 ms
6,436 KB |
testcase_04 | AC | 3 ms
6,472 KB |
testcase_05 | AC | 3 ms
6,456 KB |
testcase_06 | AC | 3 ms
6,492 KB |
testcase_07 | AC | 3 ms
6,472 KB |
testcase_08 | AC | 3 ms
6,472 KB |
testcase_09 | AC | 3 ms
6,644 KB |
testcase_10 | AC | 3 ms
6,540 KB |
testcase_11 | AC | 3 ms
6,460 KB |
testcase_12 | AC | 3 ms
6,472 KB |
testcase_13 | AC | 7 ms
6,596 KB |
testcase_14 | AC | 4 ms
6,532 KB |
testcase_15 | AC | 4 ms
6,452 KB |
testcase_16 | AC | 48 ms
8,040 KB |
testcase_17 | AC | 199 ms
8,900 KB |
testcase_18 | AC | 57 ms
8,148 KB |
testcase_19 | AC | 55 ms
8,188 KB |
testcase_20 | AC | 206 ms
8,964 KB |
testcase_21 | AC | 57 ms
8,284 KB |
testcase_22 | AC | 57 ms
8,428 KB |
testcase_23 | AC | 82 ms
8,348 KB |
testcase_24 | AC | 156 ms
8,616 KB |
testcase_25 | AC | 196 ms
8,184 KB |
testcase_26 | AC | 199 ms
8,944 KB |
testcase_27 | AC | 201 ms
9,072 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long signed int LL; typedef long long unsigned int LU; #define incID(i, l, r) for(int i = (l) ; i < (r); i++) #define incII(i, l, r) for(int i = (l) ; i <= (r); i++) #define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--) #define decII(i, l, r) for(int i = (r) ; i >= (l); i--) #define inc(i, n) incID(i, 0, n) #define inc1(i, n) incII(i, 1, n) #define dec(i, n) decID(i, 0, n) #define dec1(i, n) decII(i, 1, n) #define inII(v, l, r) ((l) <= (v) && (v) <= (r)) #define inID(v, l, r) ((l) <= (v) && (v) < (r)) #define PB push_back #define EB emplace_back #define MP make_pair #define FI first #define SE second #define PQ priority_queue #define ALL(v) v.begin(), v.end() #define RALL(v) v.rbegin(), v.rend() #define FOR(it, v) for(auto it = v.begin(); it != v.end(); ++it) #define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it) template<typename T> bool setmin(T & a, T b) { if(b < a) { a = b; return true; } else { return false; } } template<typename T> bool setmax(T & a, T b) { if(b > a) { a = b; return true; } else { return false; } } template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } } template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } } template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); } template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; } // ---- ---- LL n, k, q, b[100000], c[100000]; string a[100000]; bool used[2][100000]; LL remain[2], ans[100000]; int main() { cin >> n; assert(inII(n, 1, 100000)); assert(getchar() == ' '); cin >> k; assert(inII(k, 1, 100000)); assert(getchar() == ' '); cin >> q; assert(inII(q, 1, 100000)); assert(getchar() == '\n'); inc(i, q) { cin >> a[i]; assert(a[i] == "R" || a[i] == "C"); assert(getchar() == ' '); cin >> b[i]; assert(inII(b[i], 1, n)); assert(getchar() == ' '); cin >> c[i]; assert(inII(c[i], 1, k)); assert(getchar() == '\n'); b[i]--; c[i]--; } assert(getchar() == EOF); remain[0] = remain[1] = n; dec(i, q) { int rc = (a[i] == "R" ? 0 : 1); if(! used[rc][b[i]]) { ans[c[i]] += remain[1 - rc]; used[rc][b[i]] = true; remain[rc]--; } } ans[0] += remain[0] * remain[1]; LL sum = 0; inc(i, k) { sum += ans[i]; } assert(sum == n * n); inc(i, k) { cout << ans[i] << endl; } return 0; }