結果
問題 | No.447 ゆきこーだーの雨と雪 (2) |
ユーザー |
![]() |
提出日時 | 2016-11-18 23:05:46 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 17 ms / 2,000 ms |
コード長 | 2,518 bytes |
コンパイル時間 | 1,141 ms |
コンパイル使用メモリ | 114,708 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-26 07:55:25 |
合計ジャッジ時間 | 2,161 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
#define _CRT_SECURE_NO_WARNINGS#include <stdio.h>#include <algorithm>#include <utility>#include <functional>#include <cstring>#include <queue>#include <stack>#include <math.h>#include <iterator>#include <vector>#include <string>#include <set>#include <math.h>#include <iostream>#include<map>#include <iomanip>#include <stdlib.h>#include <list>#include <typeinfo>#include <list>#include <set>using namespace std;#define MAX_MOD 1000000007#define REP(i,n) for(long long i = 0;i < n;++i)#define LONGINF 1000000000000000000map<string, int> who;map<int, string> deter;int later[5000] = {};int scores[5000][30] = {};int now_insert = 1;int ac_counter[30] = {};int main() {int n;cin >> n;vector<int> l;REP(i, n) {int tmp;cin >> tmp;l.push_back(tmp);}int t = 0;cin >> t;REP(i, t) {string a;char bb;cin >> a >> bb;int b = (int)bb;if (who[a] == 0) {who[a] = now_insert;deter[now_insert] = a;now_insert++;}b -= 'A';int calc = 50 * l[b];ac_counter[b]++;calc += (double)calc / (double)((double)0.8 + (double)0.2*(double)ac_counter[b]);scores[who[a]][b] = calc;later[who[a]] = i;}//整理vector<pair<int, int>> final_standing;for (int i = 1;i < now_insert;++i) {int ans = 0;for (int q = 0;q < n;++q) {ans += scores[i][q];}final_standing.push_back(make_pair(ans,i));}sort(final_standing.begin(), final_standing.end(),greater<pair<int,int>>());for (int i = 0;i < now_insert - 1;++i) {if (i != now_insert-2&&final_standing[i].first == final_standing[i + 1].first) {vector<pair<int,int>> ranked;ranked.push_back(make_pair(later[final_standing[i].second], final_standing[i].second));while (true) {if (i == now_insert - 2) break;if (final_standing[i].first != final_standing[i + 1].first) break;ranked.push_back(make_pair(later[final_standing[i+1].second],final_standing[i+1].second));i++;}sort(ranked.begin(), ranked.end());for (int q = 0;q < ranked.size();++q) {int wowow = i + q+2;wowow -= ranked.size();cout << wowow << " " << deter[ranked[q].second];int too = 0;REP(j, n) {cout << " " << scores[ranked[q].second][j];too += scores[ranked[q].second][j];}cout << " " << too << endl;}}else {cout << i + 1 << " " << deter[final_standing[i].second];REP(q, n) {cout << " " << scores[final_standing[i].second][q];}cout << " " << final_standing[i].first << endl;}}return 0;}