結果

問題 No.447 ゆきこーだーの雨と雪 (2)
ユーザー guestguest
提出日時 2016-11-19 23:34:06
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 16 ms / 2,000 ms
コード長 1,093 bytes
コンパイル時間 1,841 ms
コンパイル使用メモリ 185,276 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-18 03:52:23
合計ジャッジ時間 3,301 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>


#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()
#define dnmin(a,b) (a)=min((a),(b))

using namespace std;
typedef long long ll; typedef vector<int> VI;
typedef pair<int, int> pii;
 
int main(){
 
	int n, t;
	cin >>n;
	VI hs(n);
	unordered_map<string, VI> mp;
	map<pii, string> jn;
	VI nos(n);
	rep(i,n) cin >>hs[i];
	cin >> t;
	rep(i, t){
		string s;
		char a;
		cin >> s >> a;
		int osc=-1, ono=-1;
		if(!mp.count(s)) mp[s] = VI(n+2, 0);
		else { osc=mp[s][n+1]; ono=mp[s][n];}
		mp[s][n] = i+1;
		int mz= a-'A';
		mp[s][mz] = 50 * hs[mz] + (500 * hs[mz]) / (8 + 2* (++nos[mz]));
		mp[s][n+1]  += mp[s][mz];
		if(osc !=-1) jn.erase(pii(-osc, ono));
		jn[pii(-mp[s][n+1], mp[s][n])] = s;
	}
	
	
	int ct=1;
	for(auto zx: jn){
		auto nm = zx.second;
		cout << ct++ <<" " << nm <<" ";
		rep(i,n) cout << (i? " ":"") << mp[nm][i];
		cout << " " << -zx.first.first <<"\n";
	}
	
	return 0;
}
 
0