結果

問題 No.449 ゆきこーだーの雨と雪 (4)
ユーザー pekempeypekempey
提出日時 2016-11-18 23:49:53
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,081 bytes
コンパイル時間 1,788 ms
コンパイル使用メモリ 184,480 KB
実行使用メモリ 27,568 KB
最終ジャッジ日時 2023-10-23 14:57:46
合計ジャッジ時間 22,353 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 5 ms
4,348 KB
testcase_04 AC 5 ms
4,348 KB
testcase_05 AC 5 ms
4,348 KB
testcase_06 AC 4 ms
4,348 KB
testcase_07 AC 5 ms
4,348 KB
testcase_08 AC 5 ms
4,348 KB
testcase_09 AC 5 ms
4,348 KB
testcase_10 AC 4 ms
4,348 KB
testcase_11 AC 4 ms
4,348 KB
testcase_12 AC 651 ms
27,056 KB
testcase_13 AC 606 ms
21,220 KB
testcase_14 AC 530 ms
16,932 KB
testcase_15 AC 652 ms
22,916 KB
testcase_16 AC 566 ms
19,284 KB
testcase_17 AC 581 ms
19,504 KB
testcase_18 AC 646 ms
26,984 KB
testcase_19 AC 554 ms
17,120 KB
testcase_20 AC 519 ms
16,620 KB
testcase_21 AC 608 ms
20,944 KB
testcase_22 AC 616 ms
21,260 KB
testcase_23 AC 656 ms
27,568 KB
testcase_24 AC 572 ms
19,252 KB
testcase_25 AC 583 ms
22,064 KB
testcase_26 AC 503 ms
14,680 KB
testcase_27 AC 601 ms
20,716 KB
testcase_28 AC 618 ms
21,140 KB
testcase_29 AC 511 ms
16,896 KB
testcase_30 AC 644 ms
22,616 KB
testcase_31 AC 612 ms
21,644 KB
testcase_32 AC 489 ms
15,636 KB
testcase_33 AC 527 ms
17,496 KB
testcase_34 AC 600 ms
23,144 KB
testcase_35 AC 623 ms
21,864 KB
testcase_36 AC 597 ms
23,204 KB
testcase_37 AC 392 ms
19,460 KB
testcase_38 AC 384 ms
11,656 KB
testcase_39 AC 323 ms
11,644 KB
testcase_40 AC 347 ms
11,644 KB
testcase_41 AC 380 ms
14,000 KB
testcase_42 AC 396 ms
14,008 KB
testcase_43 WA -
testcase_44 WA -
testcase_45 AC 305 ms
19,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

map<int, int> bit;

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

int sum(int 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] + 500LL * L[id] / (8 + 2 * cnt[id]);
            int tt = ii;
            if (s > 0) add(s * T + t, -1);
            add(ss * T + tt, 1);
            score[name].first = ss;
            score[name].second = tt;
        }
    }
}
0