結果

問題 No.447 ゆきこーだーの雨と雪 (2)
ユーザー moyashi_senpaimoyashi_senpai
提出日時 2016-11-18 22:55:50
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 22 ms / 2,000 ms
コード長 2,074 bytes
コンパイル時間 2,622 ms
コンパイル使用メモリ 121,740 KB
実行使用メモリ 4,756 KB
最終ジャッジ日時 2023-08-17 11:23:13
合計ジャッジ時間 2,704 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define POWT(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define MODU 1000000007
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;

const pii Dir[8] = { //?????????
	{ 0,1 },{ 0,-1 },{ 1,0 },{ -1,0 },
	{ 1,1 },{ 1,-1 },{ -1,-1 },{ -1,1 }
};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*) array, (T*) (array + N), val);
}
int point(int a, int b) {
	return 50 * a + (int) ((500 * a) / (8 + 2 * b));
}
signed main() {
	int n;
	scanf("%d", &n);
	vector<int> star(n);
	vector<int> monc(n);
	REP(i, n) {
		scanf("%d", &star[i]);
	}
	int t;
	scanf("%d", &t);
	map<string,int> lastsub;
	map<string, pair<int,map<int,int>>> man;
	REP(i, t) {
		char name[17],mon;
		int mnum;
		scanf("%s%*c%c", name, &mon);
		mnum = mon - 'A';
		monc[mnum]++;
		man[name].second[mnum] = point(star[mnum], monc[mnum]);
		man[name].first += point(star[mnum], monc[mnum]);
		lastsub[name] = -i;
	}
	priority_queue<pair<pair<int,int>,string>> ans;
	for (auto itr : man) {
		string s;
		char str [1000];
		sprintf(str," %s", itr.first.c_str());
		s += str;
		REP(i, n) {
			sprintf(str," %d", itr.second.second[i]);
			s += str;
		}
		sprintf(str," %d\n", itr.second.first);
		s += str;
		ans.push({ {itr.second.first,lastsub[itr.first]},s });
	}
	int cou = 1;
	while (ans.size()) {
		printf("%d %s",cou,ans.top().second.c_str());
		ans.pop();
		cou++;
	}
	return 0;
}
0