Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Problem: F. Xorro the Xorman
- // Contest: Codeforces - UTPC Contest 10-23-20 Div. 2
- // Memory Limit: 256 MB
- // Time Limit: 1000 ms
- // Date / Time: 2021-10-04 19:35:06
- // Author: cosenza
- // всё что ни делается - всё к лучшему
- // check list -> long long, special cases, array size, mod (a*b%p*c%p not a*b*c%p , (a-b+p)%p not a-b )
- //
- // Powered by CP Editor (https://cpeditor.org)
- //#pragma GCC optimize("Ofast")
- //#pragma GCC optimize ("unroll-loops")
- //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
- //THESE ARE LAST DITCH EFFORTS!!!
- #include <bits/stdc++.h>
- using namespace std;
- int main() {
- ios_base::sync_with_stdio(false);
- cin.tie(0);
- long long a, b;
- cin >> a >> b;
- int b1 = 63 - __builtin_clzll(b);
- bool pode = false;
- for(int i = b1; i >= 0; i--) {
- if((a & (1ll << i)) and (b & (1ll << i))) {
- pode = true;
- }
- if(!(a & (1ll << i))) {
- if(b & (1ll << i)) {
- a |= (1ll << i);
- } else {
- if(pode) {
- a |= (1ll << i);
- }
- }
- }
- }
- cout << a << "\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement