結果
問題 | No.447 ゆきこーだーの雨と雪 (2) |
ユーザー |
|
提出日時 | 2016-11-19 00:06:28 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 16 ms / 2,000 ms |
コード長 | 1,447 bytes |
コンパイル時間 | 2,129 ms |
コンパイル使用メモリ | 196,160 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-26 09:00:29 |
合計ジャッジ時間 | 3,211 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
#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 secondtypedef 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;}