版本比较
CF1935E 题解
正文
增加 1 行删除 1 行
58 行未改动5960616263646566673 行未改动58 行未改动cin >> l >> r;int ans = qry(l,r),w;for(int i = 30;i >= 0;i --)if(w = ct[i][r] - ct[i][l-1] + ((ans >> i) & 1),w >= 2) ans |= (1 << i + 1) - 1;else if(w) ans |= (1 << i);cout << ans << " ";}cout << "\n";}int main(){ios::sync_with_stdio(0),cin.tie(0);3 行未改动58 行未改动5960616263646566673 行未改动58 行未改动cin >> l >> r;int ans = qry(l,r),w;for(int i = 30;i >= 0;i --)if(w = ct[i][r] - ct[i][l-1] + ((ans >> i) & 1),w >= 2) ans |= (1 << i + 1) - 1;else if(w) ans |= (1 << i);cout << ans << " ";}cout << "\n";}int main(){ios::sync_with_stdio(0),cin.tie(0);3 行未改动