結果

問題 No.447 ゆきこーだーの雨と雪 (2)
ユーザー masamasa
提出日時 2016-11-18 23:20:33
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,520 bytes
コンパイル時間 1,987 ms
コンパイル使用メモリ 100,256 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-04 18:49:25
合計ジャッジ時間 2,063 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <map>

using namespace std;

typedef map<string, vector<int>> MSV;
typedef pair<string, vector<int>> PSV;

int f(int n, int k) {
	int ret = 50 * n + int(50.0 * n / (0.8 + 0.2 * k));
	return ret;
}

int main() {
	int n, t;
	cin >> n;

	vector<int> l(n);
	for (int i = 0; i < n; i++) {
		cin >> l[i];
	}

	cin >> t;
	string user;
	char problem_code;

	vector<int> n_ac(n, 0);
	MSV users;

	for (int i = 0; i < t; i++) {
		cin >> user >> problem_code;
		int problem = problem_code - 'A';
		n_ac[problem]++;

		int point = f(l[problem], n_ac[problem]);

		auto it = users.find(user);
		if (it == users.end()) {
			vector<int> v(n + 2, 0);
			v[problem] = point;
			v[n] += point; // total point
			v[n + 1] = i; // 最後の提出
			users[user] = v;
		} else {
			it->second[problem] = point;
			it->second[n] += point;
			it->second[n + 1] = i;
		}
	}

	vector<PSV> user_vec;
	for (auto p : users) {
		user_vec.emplace_back(make_pair(p.first, p.second));
	}

	sort(user_vec.begin(), user_vec.end(),
		 [&n](PSV &p1, PSV&p2) {
		 	if (p1.second[n] == p2.second[n]) {
		 		return p1.second[n+1] < p2.second[n+1];
		 	} else {
		 		return p1.second[n] > p2.second[n];
		 	}
		 	return true;
		 }
	);

	for (int i = 0; i < user_vec.size(); i++) {
		cout << i + 1 << " " << user_vec[i].first;
		for (int j = 0; j <= n; j++) {
			cout << " " << user_vec[i].second[j];
		}
		cout << endl;
	}

	return 0;
}
0