版本比较
[差分][思维] CF1634F Fibonacci Additions
正文
增加 6 行删除 6 行
22 行未改动232425262727282930312 行未改动3435363738393839404142434444454647487 行未改动565758596060616262636465663 行未改动22 行未改动## Code:
```cpp#include<bits/stdc++.h>#define int long long #define int long longusing namespace std;
const int N = 3e5 + 1145;
2 行未改动void ch(int x, int ad){ if(x > n || x < 1) return; int tmp = (d[x] + (ad % mod + mod) % mod) % mod; if(d[x] == 0 && tmp) cnt--; else if(d[x] != 0 && (!tmp)) cnt++; d[x] = tmp; else if(d[x] != 0 && (!tmp)) cnt++; d[x] = tmp;}
signed main(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin.tie(0); cout.tie(0); cin >> n >> q >> mod; for(int i = 1; i <= n; i++) cin >> a[i]; for(int i = 1; i <= n; i++) cin >> b[i]; f[1] = f[2] = 1;7 行未改动 else{ ch(l, -f[1]); ch(r + 1, f[r - l + 2]); ch(r + 2, f[r - l + 1]); } if(cnt == n) cout << "YES" << "\n"; else cout << "No" << "\n"; else cout << "No" << "\n"; }
return 0;}/*c[i] = a[i] - b[i]3 行未改动