結果
問題 |
No.449 ゆきこーだーの雨と雪 (4)
|
ユーザー |
![]() |
提出日時 | 2016-11-21 12:36:35 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 890 bytes |
コンパイル時間 | 2,147 ms |
コンパイル使用メモリ | 186,032 KB |
実行使用メモリ | 17,180 KB |
最終ジャッジ日時 | 2024-09-22 10:27:35 |
合計ジャッジ時間 | 10,258 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 TLE * 1 -- * 32 |
ソースコード
#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; map<pii, string> 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){ auto it = jun.find(pii(-mp[s][0],mp[s][1])); 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])); jun[pii(-mp[s][0],mp[s][1])] = s; }else{ auto it = jun.find(pii(-mp[s][0],mp[s][1])); int ans = distance(jun.begin(), it); cout << ans + 1 <<"\n"; } } return 0; }