結果
問題 |
No.447 ゆきこーだーの雨と雪 (2)
|
ユーザー |
![]() |
提出日時 | 2020-04-05 17:13:38 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 18 ms / 2,000 ms |
コード長 | 1,322 bytes |
コンパイル時間 | 4,863 ms |
コンパイル使用メモリ | 211,848 KB |
最終ジャッジ日時 | 2025-01-09 14:17:01 |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
#include<bits/stdc++.h> #define ALL(v) std::begin(v),std::end(v) using lint=long long; using lubl=long double; lint n; struct row_t{ lint sum; lint update; std::vector<lint>items; std::string name; row_t(std::string const& s):sum(0),items(n),name(s){} }; int main(){ std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false); std::cout.setf(std::ios_base::fixed);std::cout.precision(15); std::cin>>n; std::vector<lint>lev(n),ac(n); for(lint&x:lev)std::cin>>x; std::vector<row_t>table; lint q;std::cin>>q; while(q--){ std::string s;std::cin>>s; auto it=std::find_if(ALL(table),[&s](auto&&row){return row.name==s;}); if(it==table.end()){ table.emplace_back(s); it=std::prev(table.end()); } char c;std::cin>>c; lint j=c-'A'; it->update=q; it->items.at(j)=50*lev.at(j)+50*lev.at(j)/(0.8+0.2*(++ac.at(j))); } for(auto&&row:table){ row.sum=std::accumulate(ALL(row.items),0ll); } std::sort(ALL(table),[](auto&&a,auto&&b){ return a.sum!=b.sum?a.sum>b.sum:a.update>b.update; }); lint i=0; for(auto&&row:table){ std::cout<<++i<<" "<<row.name; for(lint x:row.items)std::cout<<" "<<x; std::cout<<" "<<row.sum<<'\n'; } }