結果

問題 No.449 ゆきこーだーの雨と雪 (4)
ユーザー pekempeypekempey
提出日時 2016-11-18 23:53:04
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 605 ms / 5,000 ms
コード長 1,108 bytes
コンパイル時間 1,976 ms
コンパイル使用メモリ 185,224 KB
実行使用メモリ 24,884 KB
最終ジャッジ日時 2023-10-23 14:59:19
合計ジャッジ時間 19,154 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 5 ms
4,348 KB
testcase_04 AC 4 ms
4,348 KB
testcase_05 AC 5 ms
4,348 KB
testcase_06 AC 4 ms
4,348 KB
testcase_07 AC 4 ms
4,348 KB
testcase_08 AC 4 ms
4,348 KB
testcase_09 AC 4 ms
4,348 KB
testcase_10 AC 4 ms
4,348 KB
testcase_11 AC 4 ms
4,348 KB
testcase_12 AC 605 ms
24,620 KB
testcase_13 AC 488 ms
18,752 KB
testcase_14 AC 430 ms
15,876 KB
testcase_15 AC 509 ms
19,976 KB
testcase_16 AC 457 ms
17,540 KB
testcase_17 AC 453 ms
17,792 KB
testcase_18 AC 570 ms
24,620 KB
testcase_19 AC 436 ms
16,104 KB
testcase_20 AC 422 ms
15,664 KB
testcase_21 AC 468 ms
18,508 KB
testcase_22 AC 484 ms
18,764 KB
testcase_23 AC 597 ms
24,884 KB
testcase_24 AC 457 ms
17,536 KB
testcase_25 AC 525 ms
22,956 KB
testcase_26 AC 412 ms
13,588 KB
testcase_27 AC 463 ms
18,520 KB
testcase_28 AC 474 ms
18,760 KB
testcase_29 AC 432 ms
15,860 KB
testcase_30 AC 495 ms
19,736 KB
testcase_31 AC 485 ms
19,000 KB
testcase_32 AC 415 ms
15,844 KB
testcase_33 AC 429 ms
16,404 KB
testcase_34 AC 526 ms
22,956 KB
testcase_35 AC 485 ms
19,312 KB
testcase_36 AC 543 ms
22,956 KB
testcase_37 AC 335 ms
18,972 KB
testcase_38 AC 319 ms
11,156 KB
testcase_39 AC 270 ms
11,156 KB
testcase_40 AC 274 ms
11,156 KB
testcase_41 AC 335 ms
13,532 KB
testcase_42 AC 322 ms
13,532 KB
testcase_43 AC 339 ms
13,252 KB
testcase_44 AC 337 ms
16,712 KB
testcase_45 AC 235 ms
18,972 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

unordered_map<int64_t, int> bit;

void add(int64_t k, int v) {
    for (k++; k < 1e12; k += k & -k) bit[k] += v;
}

int sum(int64_t k) {
    int res = 0;
    for (k++; k > 0; k &= k - 1) res += bit[k];
    return res;
}

int main() {
    int n, T;
    cin >> n;
    vector<int> L(n);
    for (int i = 0; i < n; i++) scanf("%d", &L[i]);
    cin >> T;
    map<string, pair<int, int>> score;
    vector<int> cnt(n);
    for (int ii = T - 1; ii >= 0; ii--) {
        string name, prob;
        cin >> name >> prob;
        if (prob[0] == '?') {
            printf("%d\n", score.size() - sum(score[name].first * T + score[name].second - 1));
        } else {
            int id = prob[0] - 'A';
            cnt[id]++;
            int s = score[name].first;
            int t = score[name].second;
            int ss = s + 50 * L[id] + 500 * L[id] / (8 + 2 * cnt[id]);
            int tt = ii;
            if (s > 0) add(1LL * s * T + t, -1);
            add(ss * T + tt, 1);
            score[name].first = ss;
            score[name].second = tt;
        }
    }
}
0