結果

問題 No.447 ゆきこーだーの雨と雪 (2)
ユーザー autumn-eelautumn-eel
提出日時 2016-11-18 23:19:58
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 23 ms / 2,000 ms
コード長 1,161 bytes
コンパイル時間 2,430 ms
コンパイル使用メモリ 192,116 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-17 12:06:44
合計ジャッジ時間 3,877 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 5 ms
4,380 KB
testcase_04 AC 4 ms
4,380 KB
testcase_05 AC 14 ms
4,384 KB
testcase_06 AC 19 ms
4,380 KB
testcase_07 AC 10 ms
4,380 KB
testcase_08 AC 11 ms
4,376 KB
testcase_09 AC 19 ms
4,380 KB
testcase_10 AC 4 ms
4,380 KB
testcase_11 AC 6 ms
4,380 KB
testcase_12 AC 8 ms
4,376 KB
testcase_13 AC 16 ms
4,380 KB
testcase_14 AC 21 ms
4,384 KB
testcase_15 AC 6 ms
4,380 KB
testcase_16 AC 5 ms
4,376 KB
testcase_17 AC 6 ms
4,376 KB
testcase_18 AC 3 ms
4,376 KB
testcase_19 AC 23 ms
4,380 KB
testcase_20 AC 21 ms
4,380 KB
testcase_21 AC 6 ms
4,380 KB
testcase_22 AC 5 ms
4,380 KB
testcase_23 AC 7 ms
4,380 KB
testcase_24 AC 16 ms
4,376 KB
testcase_25 AC 21 ms
4,380 KB
testcase_26 AC 10 ms
4,376 KB
testcase_27 AC 10 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define INF 0x3f3f3f3f
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<int, int>P;

int l[30];
int cnt[30];
int main() {
	int n; scanf("%d", &n);
	rep(i, n)cin >> l[i];
	map<string, P>mp;
	map<string, list<P>>k;
	int t; cin >> t;
	rep(i, t) {
		string s; char c; cin >> s >> c; int p = (int)c - 'A';
		cnt[p]++;
		k[s].push_back(P(p, (int)floor(50. * (double)l[p] + (50. * (double)l[p]) / (0.8 + 0.2*(double)cnt[p]))));
		mp[s].first += (int)floor(50. * (double)l[p] + (50. * (double)l[p]) / (0.8 + 0.2*(double)cnt[p]));
		mp[s].second = i;
	}
	vector<pair<string, P>>v;
	for (auto p : mp)v.push_back(p);
	sort(v.begin(), v.end(), [](pair<string, P>a, pair<string, P>b) {
		if (a.second.first != b.second.first)return a.second.first > b.second.first;
		return a.second.second < b.second.second;
	});
	rep(i, v.size()) {
		cout << i + 1 << ' ' << v[i].first;
		rep(j, n) {
			bool flag = false;
			for (auto p : k[v[i].first]) {
				if (p.first == j) {
					cout << ' ' << p.second; flag = true; break;
				}
			}
			if (!flag)cout << " 0";
		}
		cout << ' ' << v[i].second.first << endl;
	}
}
0