3
map<string, vector<pair<int, string>>> mp;9
void set(string key, string value, int timestamp) {10
mp[key].push_back(make_pair(timestamp, value));11
Max = max(Max, value);14
string get(string key, int timestamp) {15
pair<int, string> p = make_pair(timestamp, Max);16
int l = upper_bound(mp[key].begin(), mp[key].end(), p) - mp[key].begin();20
return mp[key][l - 1].second;25
* Your TimeMap object will be instantiated and called as such:26
* TimeMap* obj = new TimeMap();27
* obj->set(key,value,timestamp);28
* string param_2 = obj->get(key,timestamp);