結果

問題 No.449 ゆきこーだーの雨と雪 (4)
ユーザー pekempeypekempey
提出日時 2016-11-19 00:47:56
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 343 ms / 5,000 ms
コード長 1,043 bytes
コンパイル時間 5,429 ms
コンパイル使用メモリ 185,452 KB
実行使用メモリ 51,596 KB
最終ジャッジ日時 2023-10-23 15:48:25
合計ジャッジ時間 18,727 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 3 ms
4,348 KB
testcase_05 AC 5 ms
4,348 KB
testcase_06 AC 6 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 3 ms
4,348 KB
testcase_11 AC 3 ms
4,348 KB
testcase_12 AC 343 ms
51,332 KB
testcase_13 AC 267 ms
47,900 KB
testcase_14 AC 262 ms
44,996 KB
testcase_15 AC 260 ms
48,956 KB
testcase_16 AC 259 ms
46,316 KB
testcase_17 AC 261 ms
46,580 KB
testcase_18 AC 330 ms
51,332 KB
testcase_19 AC 263 ms
44,996 KB
testcase_20 AC 259 ms
44,732 KB
testcase_21 AC 254 ms
47,636 KB
testcase_22 AC 260 ms
47,900 KB
testcase_23 AC 330 ms
51,596 KB
testcase_24 AC 263 ms
46,316 KB
testcase_25 AC 322 ms
47,900 KB
testcase_26 AC 295 ms
42,884 KB
testcase_27 AC 250 ms
47,372 KB
testcase_28 AC 257 ms
47,636 KB
testcase_29 AC 257 ms
44,732 KB
testcase_30 AC 258 ms
48,692 KB
testcase_31 AC 266 ms
48,164 KB
testcase_32 AC 265 ms
43,940 KB
testcase_33 AC 263 ms
45,260 KB
testcase_34 AC 329 ms
48,692 KB
testcase_35 AC 262 ms
48,164 KB
testcase_36 AC 337 ms
48,692 KB
testcase_37 AC 170 ms
48,104 KB
testcase_38 AC 207 ms
42,032 KB
testcase_39 AC 200 ms
42,032 KB
testcase_40 AC 194 ms
42,032 KB
testcase_41 AC 171 ms
43,616 KB
testcase_42 AC 171 ms
43,616 KB
testcase_43 AC 247 ms
42,356 KB
testcase_44 AC 224 ms
46,316 KB
testcase_45 AC 170 ms
48,104 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;
    bit.reserve(40 * T);
    score.reserve(T);
    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