結果

問題 No.447 ゆきこーだーの雨と雪 (2)
ユーザー imulanimulan
提出日時 2016-11-19 00:06:28
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 15 ms / 2,000 ms
コード長 1,447 bytes
コンパイル時間 2,302 ms
コンパイル使用メモリ 194,932 KB
実行使用メモリ 4,568 KB
最終ジャッジ日時 2023-08-17 12:29:42
合計ジャッジ時間 3,613 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 3 ms
4,380 KB
testcase_04 AC 4 ms
4,380 KB
testcase_05 AC 10 ms
4,380 KB
testcase_06 AC 12 ms
4,376 KB
testcase_07 AC 7 ms
4,376 KB
testcase_08 AC 8 ms
4,380 KB
testcase_09 AC 13 ms
4,440 KB
testcase_10 AC 3 ms
4,376 KB
testcase_11 AC 5 ms
4,380 KB
testcase_12 AC 5 ms
4,380 KB
testcase_13 AC 11 ms
4,380 KB
testcase_14 AC 14 ms
4,568 KB
testcase_15 AC 5 ms
4,376 KB
testcase_16 AC 4 ms
4,380 KB
testcase_17 AC 4 ms
4,380 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 15 ms
4,496 KB
testcase_20 AC 14 ms
4,492 KB
testcase_21 AC 5 ms
4,376 KB
testcase_22 AC 4 ms
4,376 KB
testcase_23 AC 6 ms
4,376 KB
testcase_24 AC 11 ms
4,380 KB
testcase_25 AC 14 ms
4,408 KB
testcase_26 AC 8 ms
4,376 KB
testcase_27 AC 7 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second

typedef pair<int,int> pi;
typedef pair<pi,string> P;
int score(int l,int ac)
{
    return 50*l + (int)(floor(0.000001+50*l/(0.8+0.2*ac)));
}

int main()
{
    int n;
    scanf(" %d", &n);
    vector<int> L(n);
    rep(i,n) scanf( "%d", &L[i]);

    vector<int> ac(n,0);
    map<string,vector<int>> mp;
    map<string,int> last;

    int T;
    scanf(" %d", &T);
    rep(i,T)
    {
        string name;
        char p;
        cin >>name >>p;

        int num=p-'A';
        ++ac[num];

        if(mp.find(name)==mp.end()) mp[name]=vector<int>(n,0);
        last[name]=i;

        mp[name][num]=score(L[num],ac[num]);
    }

    vector<P> v;
    for(const auto &m:mp)
    {
        string name=m.fi;
        vector<int> t=m.se;

        int sum=0;
        rep(i,n) sum+=t[i];

        v.pb(P(pi(-sum,last[name]),name));
    }
    sort(all(v));

    rep(i,v.size())
    {
        string name=v[i].se;

        printf("%d ", i+1);
        cout << name << " ";

        vector<int> t=mp[name];
        int sum=0;
        rep(j,n)
        {
            printf("%d ", t[j]);
            sum+=t[j];
        }
        printf("%d\n", sum);
    }
    return 0;
}
0