結果

問題 No.449 ゆきこーだーの雨と雪 (4)
ユーザー guestguest
提出日時 2016-11-20 00:00:26
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,175 bytes
コンパイル時間 1,661 ms
コンパイル使用メモリ 185,320 KB
実行使用メモリ 15,812 KB
最終ジャッジ日時 2023-10-23 15:58:17
合計ジャッジ時間 10,262 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 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 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>


#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 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;
	vector<tuple<int,int,string>> jdt;
	VI nos(n);
	rep(i,n) cin >>hs[i];
	cin >> t;
	rep(i, t){
		string s;
		char a;
		cin >> s >> a;
		if(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){
				auto it = upper_bound(all(jdt), make_tuple(-osc, ono, s));
				jdt.erase(it);
			}
			auto it = upper_bound(all(jdt), make_tuple(-mp[s][n+1], mp[s][n], ""));
			jdt.insert(it, make_tuple(-mp[s][n+1], mp[s][n],s));
		}else{
			int ans = upper_bound(all(jdt), make_tuple(-mp[s][n+1], mp[s][n], s)) - jdt.begin();
			cout << ans <<"\n";
		}
	}
	
	return 0;
}
 
0