版本比较
[高维前缀和(SOS)][容斥 ]CF449D Jzzhu and Numbers
正文
增加 3 行删除 3 行
16 行未改动17181920212223242515 行未改动4142434445464748495 行未改动555657585960616216 行未改动code:```cpp#include<bits/stdc++.h>#define int long longusing namespace std;const int N = 1e6 + 10, M = 22, MAX = (1 << M), mod = 1e9 + 7;15 行未改动}signed main(){ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);cin >> n;for(int i = 1; i <= n; i++) cin >> a[i], f[a[i]]++;for(int i = 0; i < M; i++){for(int s = 0; s < MAX; s++){5 行未改动int cnt = popcnt(s);ans = (ans + (((cnt & 1) ? (mod - 1) : 1) * (fast_pow(2, f[s]) - 1 + mod)) % mod) % mod;}cout << ans;return 0;}```16 行未改动17181920212223242515 行未改动4142434445464748495 行未改动555657585960616216 行未改动code:```cpp#include<bits/stdc++.h>#define int long longusing namespace std;const int N = 1e6 + 10, M = 22, MAX = (1 << M), mod = 1e9 + 7;15 行未改动}signed main(){ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);cin >> n;for(int i = 1; i <= n; i++) cin >> a[i], f[a[i]]++;for(int i = 0; i < M; i++){for(int s = 0; s < MAX; s++){5 行未改动int cnt = popcnt(s);ans = (ans + (((cnt & 1) ? (mod - 1) : 1) * (fast_pow(2, f[s]) - 1 + mod)) % mod) % mod;}cout << ans;return 0;}```