結果

問題 No.447 ゆきこーだーの雨と雪 (2)
ユーザー TautConyTautCony
提出日時 2016-11-19 12:03:49
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 14 ms / 2,000 ms
コード長 2,919 bytes
コンパイル時間 1,348 ms
コンパイル使用メモリ 117,904 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-17 21:17:36
合計ジャッジ時間 2,735 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 4 ms
4,380 KB
testcase_04 AC 4 ms
4,376 KB
testcase_05 AC 7 ms
4,376 KB
testcase_06 AC 10 ms
4,380 KB
testcase_07 AC 7 ms
4,380 KB
testcase_08 AC 7 ms
4,380 KB
testcase_09 AC 10 ms
4,376 KB
testcase_10 AC 3 ms
4,376 KB
testcase_11 AC 5 ms
4,380 KB
testcase_12 AC 5 ms
4,376 KB
testcase_13 AC 9 ms
4,380 KB
testcase_14 AC 10 ms
4,376 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 3 ms
4,376 KB
testcase_19 AC 14 ms
4,380 KB
testcase_20 AC 11 ms
4,376 KB
testcase_21 AC 5 ms
4,376 KB
testcase_22 AC 4 ms
4,380 KB
testcase_23 AC 6 ms
4,376 KB
testcase_24 AC 11 ms
4,380 KB
testcase_25 AC 13 ms
4,376 KB
testcase_26 AC 8 ms
4,376 KB
testcase_27 AC 7 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <tuple>
#include <map>
#include <iomanip>
#include <algorithm>
#include <array>
#include <sstream>
#include <set>
//#include<regex>

using namespace std;

//STL output ********************************
template<typename T1, typename T2> std::ostream& operator << (std::ostream& os, const std::pair<T1, T2>& p) { return os << "(" << p.first << ", " << p.second << ")"; }
template<typename T> std::ostream &operator<<(std::ostream &os, const std::vector<T>& v) { bool first = true; os << "["; for (unsigned int i = 0; i < v.size(); i++) { if (!first)os << ", "; os << v[i]; first = false; }return os << "]"; }
inline std::ostream &operator<<(std::ostream &os, const std::vector<std::string>& v) { bool first = true; os << "["; for (unsigned int i = 0; i < v.size(); i++) { if (!first)os << ", "; os << "'" << v[i] << "'"; first = false; }return os << "]"; }
template<typename T, typename T2>void printarray(T  a[], T2 sz, T2 beg = 0) { for (T2 i = beg; i < sz; ++i) cout << a[i] << " "; cout << endl; }

const int INF = 0x3f3f3f3f;

struct ITEM
{
    int id;
    vector<int> arr;
    //int solved;
    int sum;
    int last;
    ITEM(): id(0)/*, solved(0)*/, sum(0), last(INF)
    {
        arr = vector<int>(32);
    }
};

int main()
{
    int N; cin >> N;
    vector<int> L(N);
    for (int i = 0; i < N; ++i)
        cin >> L[i];
    int T; cin >> T;
    int id = 0;
    map<string, int> s;
    vector<string> name;

    vector<ITEM> ret(T);
    map<int, int> index;
    int time = 1;
    for (int i = 0; i < T; ++i)
    {
        string na; char prob;
        cin >> na >> prob;
        prob -= 'A';

        int user;
        if (s.find(na) == s.end())
        {
            s[na] = id;
            name.push_back(na);
            user = id++;
        }
        else user = s[na];

        //各問題、 50×★の数+50×★の数 / (0.8+ 0.2×ACの順位)とその合計となっております。
        index[prob]++;
        //int score = 50 * L[prob] + int((50.0 * L[prob]) / (0.8 + 0.2*index[prob]));
        int score =  (50 * L[prob]) +    (50.  * L[prob]) / (0.8 + 0.2*(index[prob]));
        ret[user].id = user;
        ret[user].arr[prob] = score;
        //ret[user].solved++;
        ret[user].sum  += score;
        ret[user].last = time;
        time++;
    }

    sort(ret.begin(), ret.begin() + id, [&ret](ITEM &l, ITEM &r)
    {
        //if (L.solved == R.solved)
        //{
            if    (l.sum == r.sum) return l.last < r.last;
            return l.sum >  r.sum;
        //}
        //return L.solved > R.solved;
    });
    for(int i = 0; i < id; ++i)
    {
        cout << i+1 << " " << name[ret[i].id] << " ";
        for (int j = 0; j < N; ++j)
            cout << ret[i].arr[j] << " ";
        cout << ret[i].sum << "\n";
    }
    return 0;
}

0