結果

問題 No.449 ゆきこーだーの雨と雪 (4)
ユーザー tubo28tubo28
提出日時 2016-11-19 00:11:39
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 161 ms / 5,000 ms
コード長 2,012 bytes
コンパイル時間 2,532 ms
コンパイル使用メモリ 209,796 KB
実行使用メモリ 31,496 KB
最終ジャッジ日時 2023-10-23 15:00:31
合計ジャッジ時間 8,485 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
14,988 KB
testcase_01 AC 5 ms
14,988 KB
testcase_02 AC 5 ms
14,988 KB
testcase_03 AC 5 ms
15,024 KB
testcase_04 AC 5 ms
15,024 KB
testcase_05 AC 6 ms
15,024 KB
testcase_06 AC 8 ms
15,024 KB
testcase_07 AC 5 ms
15,024 KB
testcase_08 AC 6 ms
15,024 KB
testcase_09 AC 7 ms
15,024 KB
testcase_10 AC 5 ms
15,024 KB
testcase_11 AC 6 ms
15,024 KB
testcase_12 AC 64 ms
15,416 KB
testcase_13 AC 128 ms
19,720 KB
testcase_14 AC 111 ms
19,704 KB
testcase_15 AC 141 ms
19,708 KB
testcase_16 AC 117 ms
19,696 KB
testcase_17 AC 120 ms
19,712 KB
testcase_18 AC 64 ms
15,416 KB
testcase_19 AC 107 ms
19,704 KB
testcase_20 AC 102 ms
19,688 KB
testcase_21 AC 126 ms
19,700 KB
testcase_22 AC 126 ms
19,724 KB
testcase_23 AC 65 ms
15,416 KB
testcase_24 AC 118 ms
19,696 KB
testcase_25 AC 59 ms
15,416 KB
testcase_26 AC 54 ms
15,416 KB
testcase_27 AC 124 ms
19,708 KB
testcase_28 AC 125 ms
19,712 KB
testcase_29 AC 110 ms
19,684 KB
testcase_30 AC 141 ms
19,708 KB
testcase_31 AC 125 ms
19,724 KB
testcase_32 AC 105 ms
19,696 KB
testcase_33 AC 114 ms
19,708 KB
testcase_34 AC 58 ms
15,416 KB
testcase_35 AC 133 ms
19,712 KB
testcase_36 AC 59 ms
15,420 KB
testcase_37 AC 156 ms
31,496 KB
testcase_38 AC 133 ms
23,008 KB
testcase_39 AC 84 ms
23,008 KB
testcase_40 AC 91 ms
23,008 KB
testcase_41 AC 123 ms
23,008 KB
testcase_42 AC 118 ms
23,008 KB
testcase_43 AC 43 ms
15,316 KB
testcase_44 AC 46 ms
15,576 KB
testcase_45 AC 161 ms
31,496 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define all(c) begin(c), end(c)
#define dump(x) cerr << __LINE__ << ":\t" #x " = " << x << endl

#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/tag_and_trait.hpp>
using namespace __gnu_pbds;

using Key = tuple<int,int>; // score, lastsub
typedef tree<
    Key,
    null_type,
    less<Key>,
    rb_tree_tag,
    tree_order_statistics_node_update>
ordered_set;

int N;
int star[100010];
int T;

int solved[100010];
// user->
int score[100010], lastsub[100010];
int score_of[100010][26];

unordered_map<string,int> f;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);

    while(cin >> N){
        memset(solved, 0, sizeof solved);
        memset(score_of, 0, sizeof score_of);
        memset(lastsub, 0, sizeof lastsub);
        memset(score, 0, sizeof score);

        rep(i,N) cin >> star[i];
        cin >> T;
        int id = 0;

        ordered_set tree;

        rep(i,T){

            string name;
            cin >> name;
            if(!f.count(name)){
                f.emplace(name, id++);
            }
            int man = f[name];
            // dump(man);
            char str[10];
            cin >> str;
            auto cur = make_tuple(-score[man], lastsub[man]);

            if(str[0] == '?'){
                // cout << "q" << -score[man] << ' ' << lastsub[man] << endl;
                int ord = tree.order_of_key(cur);
                cout << ord + 1 << '\n';
            } else {
                int prob = str[0] - 'A';
                int s = 50*star[prob] + 50*star[prob] / (0.8 + 0.2*(solved[prob]+1));
                ++solved[prob];
                score_of[man][prob] = s;
                score[man] += s;
                lastsub[man] = i;
                auto nxt = make_tuple(-score[man], lastsub[man]);
                tree.erase(cur);
                tree.insert(nxt);
            }
        }
    }
}
0