Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma GCC optimize("Ofast,unroll-loops")
- #pragma GCC target("avx,avx2,fma")
- #define _CRT_SECURE_NO_WARNINGS
- #include <iostream>
- #include <vector>
- #include <string>
- #include <algorithm>
- #include <cmath>
- #include <stack>
- #include <iomanip>
- #include <fstream>
- #include <string>
- #include <set>
- #include <deque>
- #include <queue>
- #include <map>
- #include <bitset>
- #include <random>
- #include <list>
- #include <unordered_map>
- #include <unordered_set>
- #include <cassert>
- using namespace std;
- typedef long long ll;
- typedef unsigned long long ull;
- typedef long double ld;
- typedef string str;
- //typedef __int128 ultraint;
- #define sqrt sqrtl
- #define F first
- #define S second
- #define endl '\n'
- #define all(vc666) vc666.begin(), vc666.end()
- #define allr(vc666) vc666.rbegin(), vc666.rend()
- #define int long long
- #define degug(x) cerr (#x) << " " << (x) << endl;
- const ll INF = (ll)1e18;
- const ll inf = 1e11 + 7;
- const ll ONE = 1;
- const ll mod = 1e9 + 7;
- const ll m1 = 1e9 + 575179;
- const ll m2 = 1e9 + 87;
- const ll k = 347;
- const ll LG = 19;
- ld EPS = 1e-12;
- ld PI = 3.1415926535897932384;
- mt19937_64 gen(rand() + rand());
- int cnt(int x, int bit) {
- int nw = (ONE << (bit + ONE));
- int nw2 = (ONE << bit);
- int cnt = (x + ONE) / nw;
- x = x - cnt * nw + 1;
- cnt *= nw2;
- cnt += max((int)0, x - nw2);
- return cnt;
- }
- void solve() {
- int q;
- cin >> q;
- int l, r, bit, u1, u2, zxc = 0, mx = -1, zxc2 = 0, mn = INF, i;
- while (q--) {
- cin >> l >> r;
- mx = max(mx, r);
- mn = min(mn, l);
- for (bit = 0; bit < 63; bit++) {
- u1 = cnt(r, bit);
- u2 = cnt(l - 1, bit);
- u1 -= u2;
- if (u1 % 2 == 1) {
- zxc ^= (ONE << bit);
- }
- }
- }
- if (zxc == 0) {
- cout << "Lose" << endl;
- }
- else {
- cout << "Win" << endl;
- for (i = mx; i >= mn; i--) {
- if ((zxc xor i) <= i) {
- cout << i << " " << (zxc xor i) << endl;
- return;
- }
- }
- }
- }
- signed main() {
- #ifdef _DEBUG
- freopen("input.txt", "r ", stdin);
- freopen("output.txt", "w", stdout);
- #endif
- ios_base::sync_with_stdio(0);
- cin.tie(NULL);
- cout.tie(NULL);
- int t = 1;
- //cin >> t;
- while (t--) solve();
- }
- //Deisgned by skimono
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement