intget(int index, int snap_id){ auto it = upper_bound(ml[index].begin(), ml[index].end(), pair<int, int>(snap_id, INT_MAX)); return it == ml[index].begin() ? 0 : prev(it)->second; } };
/** * Your SnapshotArray object will be instantiated and called as such: * SnapshotArray* obj = new SnapshotArray(length); * obj->set(index,val); * int param_2 = obj->snap(); * int param_3 = obj->get(index,snap_id); */