結果

問題 No.449 ゆきこーだーの雨と雪 (4)
ユーザー tubo28tubo28
提出日時 2016-11-19 00:09:32
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 2,004 bytes
コンパイル時間 3,167 ms
コンパイル使用メモリ 209,800 KB
実行使用メモリ 14,596 KB
最終ジャッジ日時 2023-10-23 14:59:42
合計ジャッジ時間 10,685 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
14,592 KB
testcase_01 AC 5 ms
14,592 KB
testcase_02 AC 5 ms
14,592 KB
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 WA -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 WA -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 WA -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 WA -
testcase_30 WA -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 RE -
testcase_43 RE -
testcase_44 RE -
testcase_45 RE -
権限があれば一括ダウンロードができます

ソースコード

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[20];
int T;

int solved[30];
// 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