結果

問題 No.449 ゆきこーだーの雨と雪 (4)
ユーザー guestguest
提出日時 2016-11-21 13:13:54
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,050 bytes
コンパイル時間 1,692 ms
コンパイル使用メモリ 182,216 KB
実行使用メモリ 19,600 KB
最終ジャッジ日時 2023-10-23 15:58:54
合計ジャッジ時間 13,323 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 3 ms
4,348 KB
testcase_04 AC 3 ms
4,348 KB
testcase_05 AC 3 ms
4,348 KB
testcase_06 AC 3 ms
4,348 KB
testcase_07 AC 3 ms
4,348 KB
testcase_08 AC 3 ms
4,348 KB
testcase_09 AC 3 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 3 ms
4,348 KB
testcase_12 AC 157 ms
4,348 KB
testcase_13 AC 400 ms
8,008 KB
testcase_14 AC 288 ms
8,008 KB
testcase_15 AC 449 ms
8,008 KB
testcase_16 AC 343 ms
8,004 KB
testcase_17 AC 347 ms
8,008 KB
testcase_18 AC 155 ms
4,348 KB
testcase_19 AC 289 ms
8,008 KB
testcase_20 AC 282 ms
8,008 KB
testcase_21 AC 394 ms
8,008 KB
testcase_22 AC 401 ms
8,008 KB
testcase_23 AC 155 ms
4,348 KB
testcase_24 AC 343 ms
8,012 KB
testcase_25 AC 169 ms
4,348 KB
testcase_26 AC 182 ms
4,348 KB
testcase_27 AC 399 ms
8,008 KB
testcase_28 AC 391 ms
8,012 KB
testcase_29 AC 284 ms
8,012 KB
testcase_30 AC 449 ms
8,008 KB
testcase_31 AC 400 ms
8,008 KB
testcase_32 AC 269 ms
8,008 KB
testcase_33 AC 338 ms
8,012 KB
testcase_34 WA -
testcase_35 AC 440 ms
8,012 KB
testcase_36 WA -
testcase_37 AC 130 ms
19,600 KB
testcase_38 AC 171 ms
11,452 KB
testcase_39 AC 161 ms
11,452 KB
testcase_40 AC 163 ms
11,452 KB
testcase_41 AC 505 ms
11,452 KB
testcase_42 AC 319 ms
11,452 KB
testcase_43 WA -
testcase_44 WA -
testcase_45 AC 128 ms
19,600 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>


#define rep(x,to) for(int (x)=0;(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;
	vector<int64_t> jun;
	rep(i,n) cin >>hs[i];
	cin >> t;
	VI nos(n);
	rep(i, t){
		string s; char a;
		cin >> s >> a;
		if(!mp.count(s)) mp[s] = VI{ 0,0,0};
		if(a != '?'){
			if(mp[s][0] !=0){
				int64_t sk = (1000-mp[s][0])*500000 + mp[s][1];
				auto it = lower_bound(all(jun), sk);
				jun.erase(it);
			}
			mp[s][1] = i+1;
			int mz= a-'A';
			mp[s][0] += 50 * hs[mz] + (500 * hs[mz]) / (8 + 2* (++nos[mz]));
			int64_t sk = (1000-mp[s][0])*500000 + mp[s][1];
			auto it = lower_bound(all(jun), sk);
			jun.insert(it, sk);
		}else{
			int64_t sk = (1000-mp[s][0])*500000 + mp[s][1];
			auto it = lower_bound(all(jun), sk);
			int ans = distance(jun.begin(), it);
			cout << ans  + 1 <<"\n";
		}
	}
	return 0;
}
 
0