人傻常数大
以下使用map的抽象离散化常数过大,拿到了76pts的好成绩
map<int,int> LSH;
int yy[maxn<<1];
void LSHLSH(){
LSH.clear();
for(int i = 1; i <= m; i++){
LSH[X[i].l] = 1;//X存的是挑战区间
LSH[X[i].r] = 1;
}
int cnt = 0;
for(auto it = LSH.begin(); it != LSH.end(); it++){
++cnt;
it->second = cnt;
yy[cnt] = it->first;
}
n = cnt;
}
只改变map离散化部分为vector就过了(虽然#23 1.98s很极限)
vector<int> LSH;
void LSHLSH(){
LSH.clear();
LSH.push_back(-1);
for(int i = 1; i <= m; i++){
LSH.push_back(X[i].l);
LSH.push_back(X[i].r);
}
sort(LSH.begin(), LSH.end());
LSH.erase(unique(LSH.begin(), LSH.end()),LSH.end());
n = LSH.size()-1;
for(int i = 1; i <= m; i++){
X[i].l = lower_bound(LSH.begin(), LSH.end(), X[i].l) - LSH.begin();
X[i].r = lower_bound(LSH.begin(), LSH.end(), X[i].r) - LSH.begin();
}
}
卡了好久的常(
map的常数貌似有点太大了