結果

問題 No.449 ゆきこーだーの雨と雪 (4)
ユーザー pekempeypekempey
提出日時 2016-11-19 00:42:58
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 483 ms / 5,000 ms
コード長 996 bytes
コンパイル時間 2,062 ms
コンパイル使用メモリ 184,512 KB
実行使用メモリ 24,872 KB
最終ジャッジ日時 2023-10-23 15:05:19
合計ジャッジ時間 15,189 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 4 ms
4,348 KB
testcase_04 AC 4 ms
4,348 KB
testcase_05 AC 4 ms
4,348 KB
testcase_06 AC 4 ms
4,348 KB
testcase_07 AC 4 ms
4,348 KB
testcase_08 AC 3 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 483 ms
24,608 KB
testcase_13 AC 366 ms
18,592 KB
testcase_14 AC 331 ms
15,648 KB
testcase_15 AC 402 ms
19,572 KB
testcase_16 AC 344 ms
17,356 KB
testcase_17 AC 345 ms
17,348 KB
testcase_18 AC 480 ms
24,608 KB
testcase_19 AC 321 ms
15,896 KB
testcase_20 AC 321 ms
15,608 KB
testcase_21 AC 345 ms
18,344 KB
testcase_22 AC 338 ms
18,600 KB
testcase_23 AC 483 ms
24,872 KB
testcase_24 AC 327 ms
17,356 KB
testcase_25 AC 413 ms
22,948 KB
testcase_26 AC 318 ms
13,580 KB
testcase_27 AC 331 ms
18,352 KB
testcase_28 AC 359 ms
18,600 KB
testcase_29 AC 300 ms
15,636 KB
testcase_30 AC 347 ms
19,588 KB
testcase_31 AC 338 ms
18,840 KB
testcase_32 AC 291 ms
15,752 KB
testcase_33 AC 301 ms
16,188 KB
testcase_34 AC 434 ms
22,948 KB
testcase_35 AC 327 ms
18,880 KB
testcase_36 AC 418 ms
22,948 KB
testcase_37 AC 184 ms
18,756 KB
testcase_38 AC 206 ms
10,936 KB
testcase_39 AC 196 ms
10,936 KB
testcase_40 AC 193 ms
10,936 KB
testcase_41 AC 189 ms
13,576 KB
testcase_42 AC 190 ms
13,576 KB
testcase_43 AC 287 ms
13,248 KB
testcase_44 AC 289 ms
16,696 KB
testcase_45 AC 184 ms
18,756 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;
    unordered_map<string, pair<int, int>> score;
    vector<int> cnt(n);
    for (int ii = T - 1; ii >= 0; ii--) {
        string name, prob;
        cin >> name >> prob;
        int s, t;
        tie(s, t) = score[name];
        if (prob[0] == '?') {
            printf("%d\n", score.size() - sum(s * T + t - 1));
        } else {
            int id = prob[0] - 'A';
            cnt[id]++;
            int ss = s + 50 * L[id] + 500 * L[id] / (8 + 2 * cnt[id]);
            if (s > 0) add(1LL * s * T + t, -1);
            add(ss * T + ii, 1);
            score[name] = { ss, ii };
        }
    }
}
0