結果

問題 No.449 ゆきこーだーの雨と雪 (4)
ユーザー pekempeypekempey
提出日時 2016-11-18 23:48:14
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,079 bytes
コンパイル時間 1,905 ms
コンパイル使用メモリ 184,456 KB
実行使用メモリ 27,548 KB
最終ジャッジ日時 2023-10-23 14:55:02
合計ジャッジ時間 25,353 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 5 ms
4,348 KB
testcase_04 AC 4 ms
4,348 KB
testcase_05 AC 5 ms
4,348 KB
testcase_06 AC 5 ms
4,348 KB
testcase_07 AC 4 ms
4,348 KB
testcase_08 AC 4 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 643 ms
27,036 KB
testcase_13 AC 608 ms
21,200 KB
testcase_14 AC 537 ms
16,912 KB
testcase_15 AC 657 ms
22,896 KB
testcase_16 AC 578 ms
19,264 KB
testcase_17 AC 580 ms
19,484 KB
testcase_18 AC 632 ms
26,964 KB
testcase_19 AC 543 ms
17,100 KB
testcase_20 AC 527 ms
16,600 KB
testcase_21 AC 614 ms
20,924 KB
testcase_22 AC 619 ms
21,240 KB
testcase_23 AC 651 ms
27,548 KB
testcase_24 AC 572 ms
19,232 KB
testcase_25 AC 585 ms
22,044 KB
testcase_26 AC 505 ms
14,660 KB
testcase_27 AC 611 ms
20,696 KB
testcase_28 AC 618 ms
21,120 KB
testcase_29 AC 518 ms
16,876 KB
testcase_30 AC 657 ms
22,596 KB
testcase_31 AC 622 ms
21,624 KB
testcase_32 AC 500 ms
15,616 KB
testcase_33 AC 537 ms
17,476 KB
testcase_34 AC 1,187 ms
23,124 KB
testcase_35 AC 1,214 ms
21,844 KB
testcase_36 AC 697 ms
23,184 KB
testcase_37 AC 416 ms
19,440 KB
testcase_38 AC 405 ms
11,636 KB
testcase_39 AC 323 ms
11,624 KB
testcase_40 AC 348 ms
11,624 KB
testcase_41 AC 387 ms
13,980 KB
testcase_42 AC 379 ms
13,988 KB
testcase_43 WA -
testcase_44 WA -
testcase_45 AC 301 ms
19,440 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] + 500 * 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