版本比较
[高维前缀和(SOS)][容斥 ]CF449D Jzzhu and Numbers
正文
增加 3 行删除 3 行
16 行未改动1718192021212223242515 行未改动414243444545464748495 行未改动55565758595960616216 行未改动code:
```cpp#include<bits/stdc++.h>#define int long long #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.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;}```