QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#834736#9727. Barkley IIIremain11AC ✓1684ms222160kbC++207.4kb2024-12-27 22:13:232024-12-27 22:13:28

Judging History

你现在查看的是测评时间为 2024-12-27 22:13:28 的历史记录

  • [2025-01-13 04:09:32]
  • 自动重测本题所有获得100分的提交记录
  • 测评结果:AC
  • 用时:1803ms
  • 内存:222144kb
  • [2025-01-13 03:55:43]
  • hack成功,自动添加数据
  • (/hack/1447)
  • [2024-12-27 22:13:28]
  • 评测
  • 测评结果:100
  • 用时:1684ms
  • 内存:222160kb
  • [2024-12-27 22:13:23]
  • 提交

answer

#include<bits/stdc++.h>

using namespace std;

using ll = long long;
using ld = double;
using ull = unsigned long long;

constexpr int N = 3e5 + 5;
const ll inf = 1e16;

template<class T>
T& cmax(T &a, const T &b) {if (a < b) a = b; return a;}

template<class T>
T& cmin(T &a, const T &b) {if (a > b) a = b; return a;}

template <class T>
inline void read(T &x){
	int ch = 0, f = 0; x = 0;
	for(; !isdigit(ch); ch = getchar()) if(ch == '-') f = 1;
	for(; isdigit(ch); ch = getchar()) x = x * 10 + ch - 48;
	if(f) x = -x;
}

//区间修改
template<class T, class S>
struct Segment {
    int n;
    vector<T> tree;
    vector<S> lazy;

    Segment() {}
    Segment(int n) {init(n);}
    Segment(vector<T> &a) : n(a.size() - 1), tree((n + 1) << 2), lazy((n + 1) << 2) {
        build(1, 1, n, a);
    }
    void init(int n) {
        this->n = n;
        tree.resize((n + 1) << 2);
        lazy.resize((n + 1) << 2);
    }
    void pushup(int now){
        tree[now] = tree[now << 1] + tree[now << 1 | 1];
    }
    void build(int now, int left, int right, vector<T> &a){       //[l , r]
        if(left == right){
            tree[now] = T(a[left]);
            return ;
        }
        int mid = (left + right) >> 1;
        build(now << 1, left, mid, a);
        build(now << 1 | 1, mid + 1, right, a);
        pushup(now);
    }
	void build(vector<T> &a) {
		build(1, 1, n, a);
	}
    void push(int now, const S &x){
        lazy[now].push(x);
        tree[now].push(x);
    }
    void pushdown(int now){
        push(now << 1, lazy[now]);
        push(now << 1 | 1, lazy[now]);
        lazy[now] = S();
    }
    void modify(int now, int l, int r, int al, int ar, const S &x) {   //[l , r]
        if(al > r || ar < l){
            return;
        }
        if(al <= l && ar >= r){
            push(now, x);
            return;
        }
        pushdown(now);
        int mid = (l + r) >> 1 ;
        modify(now << 1, l, mid, al, ar, x);
        modify(now << 1 | 1, mid + 1, r, al, ar, x);
        pushup(now);
    }
    void modify(int al, int ar, const S &x){
        modify(1, 1, n, al, ar, x);
    }
	void modify(int now, int l, int r, int pos, const T &x) {   //[l , r]
        if (l == r) {
			tree[now] = x;
			return;
		}
        pushdown(now);
        int mid = (l + r) >> 1 ;
        if (pos <= mid) modify(now << 1, l, mid, pos, x);
        else modify(now << 1 | 1, mid + 1, r, pos, x);
        pushup(now);
    }
    void modify(int pos, const T &x){
        modify(1, 1, n, pos, x);
    }
    T ask(int now, int l, int r, int al, int ar) {
        if(al > r || ar < l){
            return T();
        }
        if(al <= l && ar >= r){
            return tree[now];
        }
        pushdown(now);
        int mid = (l + r) >> 1 ;
        return ask(now << 1, l, mid, al, ar) + ask(now << 1 | 1, mid + 1, r, al, ar);
    }
    T ask(int al, int ar) {
        return ask(1, 1, n, al, ar);
    }
    template<class F>
    int ask_first(int now, int l, int r, const F &f) {
        if (l == r) {
            return l;
        }
        pushdown(now);
        int mid = (l + r) >> 1 ;
        if (f(tree[now << 1])) {
            return ask_first(now << 1, l, mid, f);
        } else {
            return ask_first(now << 1 | 1, mid + 1, r, f);
        }
    }
    template<class F>
    int ask_first(const F &f) {
        if (!f(tree[1])) return 0;
        return ask_first(1, 1, n, f);
    }
    template<class F>
    int ask_last(int now, int l, int r, const F &f) {
        if (l == r) {
            return l;
        }
        pushdown(now);
        int mid = (l + r) >> 1 ;
        if (f(tree[now << 1 | 1])) {
            return ask_last(now << 1 | 1, mid + 1, r, f);
        } else {
            return ask_last(now << 1, l, mid, f);
        }
    }
    template<class F>
    int ask_last(const F &f) {
        if (!f(tree[1])) return 0;
        return ask_last(1, 1, n, f);
    }
	template<class F>
    T ask_one(int now, int l, int r, int al, int ar, const F &f) {
		if (l == r) {
			return f(tree[now]) ? tree[now] : T();
		}
        pushdown(now);
        int mid = (l + r) >> 1 ;
        if (al <= l && r <= ar) {
			// cout << l << " " << r << " " << al << " " << ar << "\n";
			if (f(tree[now << 1])) return ask_one(now << 1, l, mid, al, ar, f);
			else if (f(tree[now << 1 | 1])) return ask_one(now << 1 | 1, mid + 1, r, al, ar, f);
			return T();
		}
		T res;
        if (al <= mid && f(tree[now << 1])) res = ask_one(now << 1, l, mid, al, ar, f);
        if (res != T()) return res;
        return ask_one(now << 1 | 1, mid + 1, r, al, ar, f);
    }
    template<class F>
    T ask_one(int al, int ar, const F &f) {
        // if (!f(tree[1])) return 0;
        return ask_one(1, 1, n, al, ar, f);
    }
};

struct Info1 {
	ll x;
	Info1() : x(LONG_LONG_MAX) {}
	Info1(ll x) : x(x) {}

	void push(const Info1 &a) {
		x &= a.x;
	}
	friend Info1 operator + (const Info1 &a, const Info1 &b) {
		return a.x & b.x;
	}
	friend bool operator != (const Info1 &a, const Info1 &b) {
		return a.x != b.x;
	}
};

struct Info2 {
	ll x, y, sz;
	Info2() : x(0), y(0), sz(1) {}
	Info2(ll x, ll y, ll sz) : x(x), y(y), sz(sz) {}

	void push(const Info1 &a) {
		if (sz == 1) {
			x |= LONG_LONG_MAX ^ a.x;
		} else {
			y |= (LONG_LONG_MAX ^ a.x);
			x &= a.x;
		}
	}
	friend Info2 operator + (const Info2 &a, const Info2 &b) {
		ll x = a.x ^ b.x;
		ll y = (a.y | b.y) | (a.x & b.x);
		x = x ^ (x & y);
		// cout << "l : " << bitset<4>(a.x) << " " << bitset<4>(a.y) << "\n";
		// cout << "r : " << bitset<4>(b.x) << " " << bitset<4>(b.y) << "\n";
		// cout << bitset<4>(x) << " " << bitset<4>(y) << "\n";
		return {x, y, a.sz + b.sz};
	}
};



void solve() {
    int n, q;
    // cin >> n >> q;
	read(n), read(q);
    vector<Info1> a(n + 1);
	vector<Info2> b(n + 1);
    for (int i = 1; i <= n; ++i) {
        read(a[i].x);
		b[i].push(a[i]);
    }
	Segment<Info1, Info1> t1(n);
	Segment<Info2, Info1> t2(n);
	t1.build(a);
	t2.build(b);
	while(q--) {
		int op, l, r;
		ll x;
		// cin >> op >> l;
		read(op), read(l);
		if (op == 1) {
			// cin >> r >> x;
			read(r), read(x);
			t1.modify(l, r, x);
			t2.modify(l, r, x);
		} else if (op == 2) {
			// cin >> x;
			read(x);
			t1.modify(l, x);
			Info2 tmp;
			tmp.push(x);
			// cout << x << " " << bitset<4>(tmp.x) << "\n";
			t2.modify(l, tmp);
		} else {
			// cin >> r;
			read(r);
			auto [ox, oy, sz] = t2.ask(l, r);
			// cout << bitset<4>(ox) << " " << bitset<4>(oy) << "\n";
			auto res = t1.ask(l, r).x;
			if (ox == 0) {
				// cout << res << "\n";
				printf("%lld\n", res);
				continue;
			}
			int pos = __lg(ox);
			ll num = t1.ask_one(l, r, [&](const Info1 &info) {
				return !(info.x >> pos & 1);
			}).x;
			// cout << t1.ask(id, id).x << "\n";
			// ll la = t1.ask(l, id - 1).x, ra = t1.ask(id + 1, r).x;
			// cout << id << " " << pos << " " << la << " " << ra << "\n";
			// cout << (t1.ask(l, id - 1).x & t1.ask(id + 1, r).x) << "\n";
			for (int i = 62; i >= 0; --i) {
				if ((ox >> i & 1) && !(num >> i & 1)) {
					res |= 1ll << i;
				}
			}
			// cout << res << "\n";
			printf("%lld\n", res);
		}
	}
	
}

int main(void){
	// ios_base::sync_with_stdio(false);
	// cin.tie(nullptr), cout.tie(nullptr);
	int t = 1;
	// cin >> t;
	for (int i = 0; i < t; ++i) {
		solve();
	}
	return 0;
}

这程序好像有点Bug,我给组数据试试?

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3672kb

input:

5 9
7 7 7 6 7
3 1 5
2 1 3
3 1 5
3 1 3
1 1 2 3
3 1 3
2 2 8
3 1 3
3 1 2

output:

7
6
7
3
3
8

result:

ok 6 lines

Test #2:

score: 0
Accepted
time: 1ms
memory: 3716kb

input:

10 10
6760061359215711796 1568091718842717482 1568091718842717482 1568091718842717482 5232472783634052627 8795942500783873690 1568091718842717482 1568091718842717482 1568091718842717482 1568091718842717482
1 3 5 7587422031989082829
3 6 10
1 7 8 5197616143400216932
2 4 2518604563805514908
2 2 4533959...

output:

1568091718842717482
35184908959744
176025477579040
8795942500783873690

result:

ok 4 lines

Test #3:

score: 0
Accepted
time: 0ms
memory: 3824kb

input:

100 100
4263579105072360993 4263579105072360993 4263579105072360993 4263579105072360993 4263579105072360993 4263579105072360993 4263579105072360993 4263579105072360993 4263579105072360993 625967318191814868 4263579105072360993 4263579105072360993 4263579105072360993 4263579105072360993 4263579105072...

output:

576531121047601152
1
576460752303423488
4263579105072360993
1306043896232411137
4263579105072360993
576531121047601152
633397148123136
0
1153488865559840256
1152922054496880128
1730020640668059136
3533641810948498945
67108864
1730020640668059136
0
633397148123136
1729382296723653632
0
17300206406680...

result:

ok 78 lines

Test #4:

score: 0
Accepted
time: 1ms
memory: 3996kb

input:

1000 1000
3368486440884437410 3368486440884437410 3368486440884437410 3368486440884437410 3368486440884437410 3368486440884437410 3368486440884437410 3368486440884437410 3368486440884437410 3368486440884437410 3368486440884437410 3639580211161047627 3368486440884437410 3368486440884437410 3368486440...

output:

3368486440884437410
3368486440884437410
3368486440884437410
2251799981457408
0
0
3368486440884437410
0
3326828075601101216
592509842556584322
0
0
0
0
0
0
37154696925806592
0
0
0
3368486440884437410
0
0
3368486440884437410
0
578998425140330496
0
0
134217728
0
3368486440884437410
2306405959167115264
0...

result:

ok 732 lines

Test #5:

score: 0
Accepted
time: 90ms
memory: 24864kb

input:

100000 100000
4364025563773184234 7745126251050571359 5111681002836044963 7745126251050571359 7745126251050571359 7745126251050571359 7745126251050571359 7745126251050571359 7745126251050571359 7745126251050571359 7745126251050571359 7745126251050571359 7222555899134537718 7745126251050571359 686495...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4613942216556019776
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 75105 lines

Test #6:

score: 0
Accepted
time: 1448ms
memory: 222048kb

input:

1000000 1000000
5485203341817263234 5485203341817263234 5485203341817263234 5485203341817263234 5485203341817263234 5485203341817263234 5485203341817263234 5485203341817263234 5485203341817263234 5485203341817263234 5485203341817263234 5485203341817263234 5485203341817263234 5485203341817263234 5485...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
8796093022208
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
576460754450907136
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0...

result:

ok 749866 lines

Test #7:

score: 0
Accepted
time: 1473ms
memory: 221892kb

input:

1000000 1000000
6478641409915854014 6478641409915854014 6478641409915854014 6478641409915854014 6478641409915854014 6478641409915854014 6478641409915854014 6478641409915854014 6478641409915854014 6478641409915854014 6478641409915854014 815888006180307319 6478641409915854014 6478641409915854014 37784...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 749822 lines

Test #8:

score: 0
Accepted
time: 1481ms
memory: 221724kb

input:

1000000 1000000
8129239286682760854 3981028880940170401 2535635990161413927 8316479514668652599 5147316903112543089 4630570098268037408 8505388156841465368 2203883581249948495 581610100009626881 5079268521394939 1476469952815397946 4914699404295060276 4440084747042452220 2702894635900623841 90540586...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 749812 lines

Test #9:

score: 0
Accepted
time: 1467ms
memory: 222044kb

input:

1000000 1000000
7320373167365396487 7320373167365396487 937526916087788458 7320373167365396487 7320373167365396487 7320373167365396487 6758767667984378025 7320373167365396487 7320373167365396487 7320373167365396487 5687396935769483606 1467370155631201061 3556475128226340387 2212274051825085385 77978...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 748638 lines

Test #10:

score: 0
Accepted
time: 0ms
memory: 3544kb

input:

2 2
3937866409909043622 2873041425983999763
2 2 3645842096674595914
2 1 5018240021376355677

output:


result:

ok 0 lines

Test #11:

score: 0
Accepted
time: 1436ms
memory: 221852kb

input:

1000000 1000000
4900813446099088166 4900813446099088166 4900813446099088166 4900813446099088166 4900813446099088166 4900813446099088166 4900813446099088166 4900813446099088166 4900813446099088166 4900813446099088166 4900813446099088166 4900813446099088166 4900813446099088166 4900813446099088166 4900...

output:

4900813446099088166
4899930503817200418
4900813446099088166
4899916948900413730
4899916948900413730
4899930503817200418
4899930503817200418
4899930503817200418
4899930503817200418
4900813446099088166
288230380446679040
288230380446679040
4899930503817200418
4899930503817200418
0
768
768
288230724044...

result:

ok 748697 lines

Test #12:

score: 0
Accepted
time: 1486ms
memory: 221852kb

input:

1000000 1000000
4896682234503638342 4896682234503638342 4896682234503638342 4896682234503638342 4896682234503638342 4896682234503638342 4896682234503638342 4896682234503638342 4896682234503638342 4896682234503638342 4896682234503638342 4896682234503638342 4896682234503638342 4896682234503638342 4896...

output:

4896682234503638342
4896682234503638342
4896682234503638342
82333682484117506
4896682234503638342
82333682484117506
9150188513918978
9150188513918978
4896682234503638342
4896682234503638342
9150188513918978
4896682234503638342
9150188513918978
4896682234503638342
4896682234503638342
9150188513918978...

result:

ok 748737 lines

Test #13:

score: 0
Accepted
time: 1449ms
memory: 222040kb

input:

1000000 1000000
5828086749355423563 5828086749355423563 5828086749355423563 5828086749355423563 5828086749355423563 5828086749355423563 5828086749355423563 5828086749355423563 5828086749355423563 5828086749355423563 5828086749355423563 5828086749355423563 5828086749355423563 5828086749355423563 5828...

output:

5828086749355423563
8192
0
0
1152921504793493761
0
0
0
134217728
5828086749355423563
4647719230811407937
0
0
0
0
4647719230811407937
4611686018427396096
0
0
4415226380288
0
0
0
0
4665729214006427657
0
0
4665729213955833856
0
4665733612138661120
0
0
4611686018429485056
4666015104295802624
0
0
0
0
0
4...

result:

ok 749804 lines

Test #14:

score: 0
Accepted
time: 1450ms
memory: 221864kb

input:

1000000 1000000
1970703737173261435 1970703737173261435 1970703737173261435 1970703737173261435 1970703737173261435 1970703737173261435 1970703737173261435 1970703737173261435 1970703737173261435 1970703737173261435 1970703737173261435 1970703737173261435 1970703737173261435 1970703737173261435 1970...

output:

18014398510006272
1970703737173261435
1970703737173261435
18014398510006272
1170935903116331008
1170935903116331008
1242993501449496576
72057598332903424
72127962782629888
72057594037927936
72057598333165568
70405251923968
0
0
0
0
0
0
0
673367418922088530
72127962782892032
18014398509481984
0
704052...

result:

ok 749806 lines

Test #15:

score: 0
Accepted
time: 1438ms
memory: 221964kb

input:

1000000 1000000
1268538845505400998 1268538845505400998 1268538845505400998 1268538845505400998 1268538845505400998 1268538845505400998 1268538845505400998 1268538845505400998 1268538845505400998 1268538845505400998 1268538845505400998 1268538845505400998 1268538845505400998 1268538845505400998 1268...

output:

1191203210145169410
0
0
0
0
0
0
0
8589934592
705069918064678
704786953404416
0
0
1268538845505400998
1268538845505400998
4503633987117056
8589934592
0
633318697730048
2251804108783616
0
0
0
0
4503599627374592
0
0
0
0
704791248371712
1099511627776
0
0
0
1268538845505400998
0
0
633318731153408
1268538...

result:

ok 749818 lines

Test #16:

score: 0
Accepted
time: 1447ms
memory: 221844kb

input:

1000000 1000000
8796374617094329340 8796374617094329340 8796374617094329340 8796374617094329340 8796374617094329340 8796374617094329340 8796374617094329340 8796374617094329340 8796374617094329340 8796374617094329340 8796374617094329340 8796374617094329340 8796374617094329340 8796374617094329340 8796...

output:

0
0
0
0
0
0
0
0
0
0
4612249037637189632
0
0
0
0
0
0
144115189706063880
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
8219350795484238412
0
0
0
536870912
0
0
0
0
0
0
8214847195317895748
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
144115188092633600
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 749921 lines

Test #17:

score: 0
Accepted
time: 1432ms
memory: 222032kb

input:

1000000 1000000
1639525139600828208 1639525139600828208 1639525139600828208 1639525139600828208 1639525139600828208 1639525139600828208 1639525139600828208 1639525139600828208 1639525139600828208 1639525139600828208 1639525139600828208 1639525139600828208 1639525139600828208 1639525139600828208 1639...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
324259173170675712
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
288231492843216896
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
144115188075864064
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0...

result:

ok 749798 lines

Test #18:

score: 0
Accepted
time: 1318ms
memory: 221892kb

input:

1000000 1000000
504297928904866451 504297928904866451 504297928904866451 504297928904866451 504297928904866451 504297928904866451 504297928904866451 504297928904866451 504297928904866451 504297928904866451 504297928904866451 504297928904866451 504297928904866451 504297928904866451 504297928904866451...

output:

504297928904866451
504297928904866451
504297928904866451
504297928904866451
504297928904866451
504297928904866451
504297928904866451
504297928904866451
504297928904866451
504297928904866451
292733989738811392
504297928904866451
504297928904866451
504297928904866451
504297928904866451
504297928904866...

result:

ok 332866 lines

Test #19:

score: 0
Accepted
time: 1592ms
memory: 222076kb

input:

1000000 1000000
2984855923226151208 2984855923226151208 2984855923226151208 2984855923226151208 2984855923226151208 2984855923226151208 2984855923226151208 2984855923226151208 2984855923226151208 2984855923226151208 2984855923226151208 2984855923226151208 2984855923226151208 2984855923226151208 2984...

output:

2984855923226151208

result:

ok single line: '2984855923226151208'

Test #20:

score: 0
Accepted
time: 753ms
memory: 221800kb

input:

1000000 1000000
2067242734448201478 2067242734448201478 2067242734448201478 2067242734448201478 2067242734448201478 2067242734448201478 2067242734448201478 2067242734448201478 2067242734448201478 2067242734448201478 2067242734448201478 2067242734448201478 2067242734448201478 2067242734448201478 2067...

output:

0

result:

ok single line: '0'

Test #21:

score: 0
Accepted
time: 1535ms
memory: 221940kb

input:

1000000 1000000
4549453206535718492 4549453206535718492 4549453206535718492 4549453206535718492 4549453206535718492 4549453206535718492 4549453206535718492 4549453206535718492 4549453206535718492 4549453206535718492 4549453206535718492 4549453206535718492 4549453206535718492 4549453206535718492 4549...

output:

4549453206535718492
4549453206535718492
4549453206535718492
4549453206535718492
4549453206535718492
4549453206535718492
4549453206535718492
4549453206535718492
4549453206535718492
4549453206535718492
4549453206535718492
4549453206535718492
4549453206535718492
4549453206535718492
4549453206535718492
...

result:

ok 1000000 lines

Test #22:

score: 0
Accepted
time: 1440ms
memory: 221840kb

input:

1000000 1000000
508429140500316275 508429140500316275 508429140500316275 508429140500316275 508429140500316275 508429140500316275 508429140500316275 508429140500316275 508429140500316275 508429140500316275 508429140500316275 508429140500316275 508429140500316275 508429140500316275 508429140500316275...

output:

508429140500316275
508429140500316275
508429140500316275
508429140500316275
508429140500316275
508429140500316275
508429140500316275
508429140500316275
508429140500316275
508429140500316275
508429140500316275
508429140500316275
508429140500316275
508429140500316275
508429140500316275
508429140500316...

result:

ok 749894 lines

Test #23:

score: 0
Accepted
time: 1319ms
memory: 222032kb

input:

1000000 1000000
6184554809109693663 6184554809109693663 6184554809109693663 6184554809109693663 6184554809109693663 6184554809109693663 6184554809109693663 6184554809109693663 6184554809109693663 6184554809109693663 6184554809109693663 6184554809109693663 6184554809109693663 6184554809109693663 6184...

output:

72057594037927936
108438303632146450
5819200270512603152
396527890631622850
4683745811488571528
6184554809109693663
0
72057594037927936
108438303632146450
6184554809109693663
6184554809109693663
72059793061183624
36099165763141632
4683745811488571528
6184554809109693663
6184554809109693663
720575940...

result:

ok 332716 lines

Test #24:

score: 0
Accepted
time: 1577ms
memory: 221964kb

input:

1000000 1000000
8665112799136011124 8665112799136011124 8665112799136011124 8665112799136011124 8665112799136011124 8665112799136011124 8665112799136011124 8665112799136011124 8665112799136011124 8665112799136011124 8665112799136011124 8665112799136011124 8665112799136011124 8665112799136011124 8665...

output:

8665112799136011124

result:

ok single line: '8665112799136011124'

Test #25:

score: 0
Accepted
time: 796ms
memory: 221912kb

input:

1000000 1000000
7747499610358061394 7747499610358061394 7747499610358061394 7747499610358061394 7747499610358061394 7747499610358061394 7747499610358061394 7747499610358061394 7747499610358061394 7747499610358061394 7747499610358061394 7747499610358061394 7747499610358061394 7747499610358061394 7747...

output:

0

result:

ok single line: '0'

Test #26:

score: 0
Accepted
time: 1684ms
memory: 222048kb

input:

1000000 1000000
1006338049885769895 1006338049885769895 1006338049885769895 1006338049885769895 1006338049885769895 1006338049885769895 1006338049885769895 1006338049885769895 1006338049885769895 1006338049885769895 1006338049885769895 1006338049885769895 1006338049885769895 1006338049885769895 1006...

output:

1006338049885769895
1006338049885769895
865598272308383749
1006338049885769895
586620239750365190
1006338049885769895
1006338049885769895
577586652210266114
613615520096321538
1006338049885769895
1006338049885769895
1006338049885769895
1006338049885769895
1006338049885769895
1125899906842624
1006338...

result:

ok 1000000 lines

Test #27:

score: 0
Accepted
time: 1467ms
memory: 222036kb

input:

1000000 1000000
6188686016410176191 6188686016410176191 6188686016410176191 6188686016410176191 6188686016410176191 6188686016410176191 6188686016410176191 6188686016410176191 6188686016410176191 6188686016410176191 6188686016410176191 6188686016410176191 6188686016410176191 6188686016410176191 6188...

output:

6188686016410176191
0
0
6188686016410176191
4612248968380942372
6188686016410176191
6188686016410176191
6188686016410176191
6188686016410176191
1234022721638778909
0
6188686016410176191
0
6188686016410176191
6188686016410176191
6188686016410176191
6188686016410176191
4738491614543890493
540431955284...

result:

ok 748681 lines

Test #28:

score: 0
Accepted
time: 1331ms
memory: 222080kb

input:

1000000 1000000
7177992877208284442 7177992877208284442 7177992877208284442 7177992877208284442 7177992877208284442 7177992877208284442 7177992877208284442 7177992877208284442 7177992877208284442 7177992877208284442 7177992877208284442 7177992877208284442 7177992877208284442 7177992877208284442 7177...

output:

7177992877208284442
0
0
0
0
0
0
0
2216739995648
2451084097464860672
7177992877208284442
2309291391953440018
0
0
67108864
0
0
0
0
0
0
7177992877208284442
0
0
0
0
0
0
0
7177992877208284442
0
0
7177992877208284442
0
0
0
536870912
0
0
0
0
0
0
0
7177992877208284442
0
7177992877208284442
0
0
0
0
0
0
0
0
0...

result:

ok 333960 lines

Test #29:

score: 0
Accepted
time: 1600ms
memory: 221832kb

input:

1000000 1000000
435178830379826095 435178830379826095 435178830379826095 435178830379826095 435178830379826095 435178830379826095 435178830379826095 435178830379826095 435178830379826095 435178830379826095 435178830379826095 435178830379826095 435178830379826095 435178830379826095 435178830379826095...

output:

0

result:

ok single line: '0'

Test #30:

score: 0
Accepted
time: 788ms
memory: 222088kb

input:

1000000 1000000
8740937678456652174 8740937678456652174 8740937678456652174 8740937678456652174 8740937678456652174 8740937678456652174 8740937678456652174 8740937678456652174 8740937678456652174 8740937678456652174 8740937678456652174 8740937678456652174 8740937678456652174 8740937678456652174 8740...

output:

0

result:

ok single line: '0'

Test #31:

score: 0
Accepted
time: 1584ms
memory: 221976kb

input:

1000000 1000000
1999776117984360675 1999776117984360675 1999776117984360675 1999776117984360675 1999776117984360675 1999776117984360675 1999776117984360675 1999776117984360675 1999776117984360675 1999776117984360675 1999776117984360675 1999776117984360675 1999776117984360675 1999776117984360675 1999...

output:

0
0
36028797018963968
576601489892724738
0
0
0
36028797018963968
0
0
8388608
0
0
0
144115188075855872
1999776117984360675
0
0
0
720575940450582530
0
0
0
1783427379079682112
0
0
1999776117984360675
67108864
0
0
1999776117984360675
0
0
0
0
0
0
180145668722001922
0
0
1999776117984360675
0
0
57646075237...

result:

ok 1000000 lines

Test #32:

score: 0
Accepted
time: 1458ms
memory: 221844kb

input:

1000000 1000000
7182124084508766970 7182124084508766970 7182124084508766970 7182124084508766970 7182124084508766970 7182124084508766970 7182124084508766970 7182124084508766970 7182124084508766970 7182124084508766970 7182124084508766970 7182124084508766970 7182124084508766970 7182124084508766970 7182...

output:

0
0
1140850688
34359738368
0
7182124084508766970
0
7182124084508766970
0
2558050962170446072
0
0
108088316276768776
0
0
0
72057594037928000
0
7182124084508766970
7182124084508766970
0
0
0
144115462970540032
0
0
4613942220590940160
0
4611690416473899008
7182124084508766970
0
536875008
0
0
0
461168601...

result:

ok 748671 lines

Test #33:

score: 0
Accepted
time: 1320ms
memory: 221840kb

input:

1000000 1000000
1942977031860337769 1942977031860337769 1942977031860337769 1942977031860337769 1942977031860337769 1942977031860337769 1942977031860337769 1942977031860337769 1942977031860337769 1942977031860337769 1942977031860337769 1942977031860337769 1942977031860337769 1942977031860337769 1942...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1942...

result:

ok 333672 lines

Test #34:

score: 0
Accepted
time: 1547ms
memory: 221852kb

input:

1000000 1000000
4423535017591687934 4423535017591687934 4423535017591687934 4423535017591687934 4423535017591687934 4423535017591687934 4423535017591687934 4423535017591687934 4423535017591687934 4423535017591687934 4423535017591687934 4423535017591687934 4423535017591687934 4423535017591687934 4423...

output:

0

result:

ok single line: '0'

Test #35:

score: 0
Accepted
time: 738ms
memory: 221972kb

input:

1000000 1000000
3505921828813738205 3505921828813738205 3505921828813738205 3505921828813738205 3505921828813738205 3505921828813738205 3505921828813738205 3505921828813738205 3505921828813738205 3505921828813738205 3505921828813738205 3505921828813738205 3505921828813738205 3505921828813738205 3505...

output:

0

result:

ok single line: '0'

Test #36:

score: 0
Accepted
time: 1494ms
memory: 222112kb

input:

1000000 1000000
5988132305196222514 5988132305196222514 5988132305196222514 5988132305196222514 5988132305196222514 5988132305196222514 5988132305196222514 5988132305196222514 5988132305196222514 5988132305196222514 5988132305196222514 5988132305196222514 5988132305196222514 5988132305196222514 5988...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4194304
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 1000000 lines

Test #37:

score: 0
Accepted
time: 1444ms
memory: 221872kb

input:

1000000 1000000
1947108239160820297 1947108239160820297 1947108239160820297 1947108239160820297 1947108239160820297 1947108239160820297 1947108239160820297 1947108239160820297 1947108239160820297 1947108239160820297 1947108239160820297 1947108239160820297 1947108239160820297 1947108239160820297 1947...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
72057594037927936
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 749802 lines

Test #38:

score: 0
Accepted
time: 1314ms
memory: 221976kb

input:

1000000 1000000
7317107235147368050 7317107235147368050 7317107235147368050 4600578496744841855 7317107235147368050 7317107235147368050 7317107235147368050 7317107235147368050 7317107235147368050 7317107235147368050 7317107235147368050 7317107235147368050 7317107235147368050 7317107235147368050 7317...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 333436 lines

Test #39:

score: 0
Accepted
time: 1556ms
memory: 221816kb

input:

1000000 1000000
574293188318909704 4944707468177635433 574293188318909704 574293188318909704 574293188318909704 574293188318909704 574293188318909704 574293188318909704 574293188318909704 574293188318909704 574293188318909704 574293188318909704 574293188318909704 574293188318909704 57429318831890970...

output:

0

result:

ok single line: '0'

Test #40:

score: 0
Accepted
time: 742ms
memory: 221952kb

input:

1000000 1000000
8880052036395735782 3370270453805280236 8880052036395735782 8880052036395735782 8880052036395735782 1658134037767948557 8880052036395735782 8880052036395735782 8880052036395735782 8880052036395735782 8880052036395735782 8880052036395735782 8880052036395735782 8880052036395735782 8880...

output:

0

result:

ok single line: '0'

Test #41:

score: 0
Accepted
time: 1498ms
memory: 221984kb

input:

1000000 1000000
2138890471628476987 2138890471628476987 2138890471628476987 2138890471628476987 2701792061270764955 2138890471628476987 2138890471628476987 2138890471628476987 2138890471628476987 2138890471628476987 2138890471628476987 2138890471628476987 2138890471628476987 2138890471628476987 2138...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 1000000 lines

Test #42:

score: 0
Accepted
time: 1402ms
memory: 222012kb

input:

1000000 1000000
7321238446742817875 7321238446742817875 7321238446742817875 7321238446742817875 7321238446742817875 7321238446742817875 7321238446742817875 7321238446742817875 7321238446742817875 7820924246120346674 7321238446742817875 7321238446742817875 5438336241901164245 7321238446742817875 7321...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 749867 lines

Test #43:

score: 0
Accepted
time: 1320ms
memory: 222044kb

input:

1000000 1000000
3054479303901583481 8542634789265589102 8763189460173490994 347954343321867304 5222257548302493370 712096612126303857 2867956275070561479 6768117976397374494 974347337482414457 4846917705740109840 1173714437444948014 7689180196230725026 1870065106406661228 5713656305935716013 8838370...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 332080 lines

Test #44:

score: 0
Accepted
time: 1567ms
memory: 222024kb

input:

1000000 1000000
3876614458574008376 4741853542709157004 4113796830973601145 2046436256465908709 3055342624729765891 1192232949927567332 3617135185251329161 4244429430125165045 9008946355953563209 7538283737575629071 3124585565884909456 7802900471543569769 7325524157133848371 8097641637928408187 8181...

output:

0

result:

ok single line: '0'

Test #45:

score: 0
Accepted
time: 770ms
memory: 222160kb

input:

1000000 1000000
2204224844440371035 4706225475966106828 7590764880989545789 968258618815192087 4871801479478214208 8334168953004088852 5815686574630432208 9044047138872679740 352877046176358731 7058547126911457861 8927495754168168077 4858322205252282008 4007046136625129447 7641555299477879625 795068...

output:

0

result:

ok single line: '0'

Test #46:

score: 0
Accepted
time: 1515ms
memory: 221796kb

input:

1000000 1000000
8572456815015360828 9065175774525643199 8907194210947259255 5840576792698844521 4768429288789849247 1083881102283466146 5337575929083902441 4896724651392637579 1795095553483724716 2215948131189145110 4899679426885149279 8573239497676519612 5378303725044348237 8120677465899761982 1446...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 1000000 lines

Test #47:

score: 0
Accepted
time: 1423ms
memory: 221852kb

input:

1000000 1000000
6350775739666562514 2830574490951496717 5055429467350151491 2114122379229172904 5612631682420972581 4063544390268497051 3854023556991475654 6003873803436605896 3086602084692080112 2112115579992567114 6444273330101427721 566510939575940430 7661840119654565299 1795465237863212561 48804...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 749892 lines

Extra Test:

score: 0
Extra Test Passed