結果
問題 |
No.447 ゆきこーだーの雨と雪 (2)
|
ユーザー |
![]() |
提出日時 | 2019-04-24 10:51:25 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 17 ms / 2,000 ms |
コード長 | 1,835 bytes |
コンパイル時間 | 2,401 ms |
コンパイル使用メモリ | 195,172 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-07 11:13:41 |
合計ジャッジ時間 | 3,545 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
#include<bits/stdc++.h> using namespace std; using ll = long long; #define FOR(i,a,b) for(ll i=(a);i<(b);++i) #define ALL(v) (v).begin(), (v).end() #define p(s) cout<<(s)<<endl #define p2(s, t) cout << (s) << " " << (t) << endl #define br() p("") #define pn(s) cout << (#s) << " " << (s) << endl ll N; struct Account{ string name; ll time; vector<ll> scores; ll sum = 0; Account(){ name = "-1"; time = -1; scores.resize(N); } void AddScore(ll i, ll score){ scores[i] = score; sum += score; } string ToString(){ stringstream ss; ss << name << " "; for(ll score : scores){ ss << score << " "; } ss << sum; return ss.str(); } bool operator<(const Account &another) const { if(sum == another.sum){ return time > another.time; }else{ return sum < another.sum; } } }; ll COUNT[30]; ll calc_score(ll id, ll star){ COUNT[id]++; ll rank = COUNT[id]; return 50 * star + (50 * star) / (0.8 + 0.2 * rank); } int main(){ cin.tie(0); ios::sync_with_stdio(false); // input cin >> N; vector<ll> L(N); FOR(i, 0, N){ cin >> L.at(i); } ll T; cin >> T; map<string, Account> mp; FOR(i, 0, T){ string name; char P; cin >> name >> P; ll id = P - 'A'; ll star = L[id]; ll score = calc_score(id, star); mp[name].name = name; mp[name].AddScore(id, score); mp[name].time = i; } vector<Account> V; for(auto p : mp){ V.push_back(p.second); } sort(ALL(V)); reverse(ALL(V)); FOR(i, 0 ,V.size()){ cout << i+1 << " " << V[i].ToString() << endl; } return 0; }