結果
問題 | No.447 ゆきこーだーの雨と雪 (2) |
ユーザー |
![]() |
提出日時 | 2016-11-19 00:23:42 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 26 ms / 2,000 ms |
コード長 | 1,503 bytes |
コンパイル時間 | 775 ms |
コンパイル使用メモリ | 65,740 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-26 09:54:27 |
合計ジャッジ時間 | 1,869 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
#include <iostream>#include <string>#include <algorithm>using namespace std;struct grd {string name;int last_ac, point;int p[27];};int N, L[27], Lsub[27], T, g_size = 0;grd g[4002];bool comp(const grd &g1, const grd &g2) {if(g1.point == g2.point) return g1.last_ac < g2.last_ac;return g1.point > g2.point;}int main(void) {cin.tie(0);ios::sync_with_stdio(false);fill(Lsub, Lsub + 27, 1);string n;char p;bool flag = false;cin >> N;for(int i = 0; i < N; i++) {cin >> L[i];}cin >> T;for(int i = 0; i < T; i++) {cin >> n >> p;flag = false;for(int j = 0; j < g_size; ++j) {if(g[j].name == n) {g[j].p[p - 'A'] = (int)(50*L[p-'A'] + (50*L[p-'A'] / (0.8 + 0.2 * Lsub[p-'A']++)));g[j].point+=g[j].p[p-'A'];g[j].last_ac = i;flag = true;}}if(!flag) {g[g_size].name = n;g[g_size].p[p-'A'] = (int)(50.0*L[p-'A'] + (50.0*L[p-'A'] / (0.8 + 0.2 * Lsub[p-'A']++)));g[g_size].point+=g[g_size].p[p-'A'];g[g_size].last_ac = i;g_size++;}}sort(g, g + g_size, comp);for(int i = 0; i < g_size; ++i) {cout << i+1 << " " << g[i].name << " ";for(int j = 0; j < N; ++j) {cout << g[i].p[j] << " ";}cout << g[i].point << endl;}return 0;}