QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#427286#8775. MountainCraftucup-team3099#AC ✓573ms153988kbC++239.3kb2024-06-01 11:58:252024-06-01 11:58:26

Judging History

你现在查看的是最新测评结果

  • [2024-06-01 11:58:26]
  • 评测
  • 测评结果:AC
  • 用时:573ms
  • 内存:153988kb
  • [2024-06-01 11:58:25]
  • 提交

answer

// #pragma GCC optimize("O3,unroll-loops")
#include <bits/stdc++.h>
// #include <x86intrin.h>
using namespace std;
#if __cplusplus >= 202002L
using namespace numbers;
#endif

template<bool HAS_QUERY, bool HAS_UPDATE, class B, class T, class U, class F1, class F2, class F3, class F4>
struct segment_tree_dynamic_base{
	static_assert(HAS_QUERY || HAS_UPDATE);
#define ifQ if constexpr(HAS_QUERY)
#define ifU if constexpr(HAS_UPDATE)
	B low, high; // All coordinates lie in range [low, high)
	F1 T_init; // T_init(l, r): initial aggregated value for [l, r)
	vector<int> left; // left child
	vector<int> right; // right child
	vector<int> pv; // parent
	vector<T> data;
	vector<U> data_action;
	F2 TT; // monoid operation (always adjacent)
	T T_id; // monoid identity
	F3 UU; // monoid operation (superset, subset)
	U U_id; // monoid identity
	F4 UT; // action of U on T (superset, subset)
	segment_tree_dynamic_base(B low, B high, F1 T_init, F2 TT, T T_id, F3 UU, U U_id, F4 UT): low(low), high(high), T_init(T_init), TT(TT), T_id(T_id), UU(UU), U_id(U_id), UT(UT){
		assert(low < high);
		new_state(T_init(low, high), U_id);
	}
	void extend(int u, B l, B r){
		if(!~left[u]){
			B m = l + (r - l >> 1);
			left[u] = new_state(T_init(l, m), U_id);
			right[u] = new_state(T_init(m, r), U_id);
			pv[left[u]] = pv[right[u]] = u;
		}
	}
	int last_state(){
		return (int)data.size() - 1;
	}
	int new_state(T x, U f){
		left.push_back(-1);
		right.push_back(-1);
		pv.push_back(-1);
		ifQ data.push_back(x);
		ifU data_action.push_back(f);
		return last_state();
	}
	void push(int u){
		static_assert(HAS_UPDATE);
		int v = left[u], w = right[u];
		ifQ data[v] = UT(data_action[u], data[v]);
		data_action[v] = UU(data_action[u], data_action[v]);
		ifQ data[w] = UT(data_action[u], data[w]);
		data_action[w] = UU(data_action[u], data_action[w]);
		data_action[u] = U_id;
	}
	// O(log(n))
	T query(B p){
		static_assert(HAS_QUERY);
		assert(low <= p && p < high);
		int u = 0;
		B l = low, r = high;
		while(true){
			if(r - l == 1) return data[u];
			extend(u, l, r);
			ifU push(u);
			B m = l + (r - l >> 1);
			if(p < m) u = left[u], r = m;
			else u = right[u], l = m;
		}
	}
	// O(log(n))
	U query_action(B p){
		static_assert(!HAS_QUERY && HAS_UPDATE);
		assert(low <= p && p < high);
		int u = 0;
		B l = low, r = high;
		while(true){
			if(r - l == 1) return data_action[u];
			extend(u, l, r);
			push(u);
			B m = l + (r - l >> 1);
			if(p < m) u = left[u], r = m;
			else u = right[u], l = m;
		}
	}
	// O(log(n))
	T query(B ql, B qr){
		static_assert(HAS_QUERY);
		assert(low <= ql && ql <= qr && qr <= high);
		auto recurse = [&](auto recurse, int u, B l, B r)->T{
			if(qr <= l || r <= ql) return T_id;
			if(ql <= l && r <= qr) return data[u];
			extend(u, l, r);
			ifU push(u);
			B m = l + (r - l >> 1);
			return TT(recurse(recurse, left[u], l, m), recurse(recurse, right[u], m, r));
		};
		return recurse(recurse, 0, low, high);
	}
	// O(1)
	T query_all() const{
		static_assert(HAS_QUERY);
		return data[0];
	}
	// O(log(n))
	void set(B p, T x){
		static_assert(HAS_QUERY);
		assert(low <= p && p < high);
		int u = 0;
		B l = low, r = high;
		while(true){
			if(r - l == 1){
				data[u] = x;
				break;
			}
			extend(u, l, r);
			ifU push(u);
			B m = l + (r - l >> 1);
			if(p < m) u = left[u], r = m;
			else u = right[u], l = m;
		}
		while(u > 0){
			u = pv[u];
			data[u] = TT(data[left[u]], data[right[u]]);
		}
	}
	// O(log(n))
	void set_action(B p, U f){
		static_assert(!HAS_QUERY && HAS_UPDATE);
		assert(low <= p && p < high);
		int u = 0;
		B l = low, r = high;
		while(true){
			if(r - l == 1){
				data_action[u] = f;
				break;
			}
			extend(u, l, r);
			push(u);
			B m = l + (r - l >> 1);
			if(p < m) u = left[u], r = m;
			else u = right[u], l = m;
		}
	}
	// O(log(n))
	void update(B p, U f){
		static_assert(HAS_UPDATE);
		assert(low <= p && p < high);
		int u = 0;
		B l = low, r = high;
		while(true){
			if(r - l == 1){
				ifQ data[u] = UT(f, data[u]);
				data_action[u] = UU(f, data_action[u]);
				break;
			}
			extend(u, l, r);
			push(u);
			B m = l + (r - l >> 1);
			if(p < m) u = left[u], r = m;
			else u = right[u], l = m;
		}
		while(u > 0){
			u = pv[u];
			data[u] = TT(data[left[u]], data[right[u]]);
		}
	}
	// O(log(n))
	void update(B ql, B qr, U f){
		static_assert(HAS_UPDATE);
		assert(low <= ql && ql <= qr && qr <= high);
		if(ql == qr) return;
		auto recurse = [&](auto self, int u, B l, B r)->void{
			if(qr <= l || r <= ql) return;
			if(ql <= l && r <= qr){
				ifQ data[u] = UT(f, data[u]);
				data_action[u] = UU(f, data_action[u]);
				return;
			}
			extend(u, l, r);
			push(u);
			B m = l + (r - l >> 1);
			self(self, left[u], l, m), self(self, right[u], m, r);
			ifQ data[u] = TT(data[left[u]], data[right[u]]);
		};
		recurse(recurse, 0, low, high);
	}
	// pred(sum[l, r)) is T, T, ..., T, F, F, ..., F
	// Returns max r with T
	// O(log(n))
	B max_pref(B ql, auto pred){
		static_assert(HAS_QUERY);
		assert(low <= ql && ql <= high && pred(T_id));
		if(ql == high) return ql;
		T pref = T_id;
		auto recurse = [&](auto self, int u, B l, B r)->B{
			if(r <= ql) return -1;
			if(ql <= l && pred(TT(pref, data[u]))){
				pref = TT(pref, data[u]);
				return -1;
			}
			if(r - l == 1) return l;
			extend(u, l, r);
			ifU push(u);
			B m = l + (r - l >> 1), p = self(self, left[u], l, m);
			return ~p ? p : self(self, right[u], m, r);
		};
		B qr = recurse(recurse, 0, low, high);
		if(!~qr) qr = high;
		return qr;
	}
	// pred(sum[l, r)) is F, F, ..., F, T, T, ..., T
	// Returns min l with T
	// O(log(n))
	B min_suff(B qr, auto pred){
		static_assert(HAS_QUERY);
		assert(low <= qr && qr <= high && pred(T_id));
		if(qr == low) return qr;
		T suff = T_id;
		auto recurse = [&](auto self, int u, B l, B r)->B{
			if(qr <= l) return -1;
			if(r <= qr && pred(TT(data[u], suff))){
				suff = TT(data[u], suff);
				return -1;
			}
			if(r - l == 1) return r;
			extend(u, l, r);
			ifU push(u);
			B m = l + (r - l >> 1), p = self(self, right[u], m, r);
			return ~p ? p : self(self, left[u], l, m);
		};
		B ql = recurse(recurse, 0, low, high);
		if(!~ql) ql = low;
		return ql;
	}
	template<class output_stream>
	friend output_stream &operator<<(output_stream &out, segment_tree_dynamic_base<HAS_QUERY, HAS_UPDATE, B, T, U, F1, F2, F3, F4> seg){
		out << "{";
		for(auto i = 0; i < seg.n; ++ i){
			ifQ out << seg.query(i);
			else out << seg.query_action(i);
			if(i != seg.n - 1) out << ", ";
		}
		return out << '}';
	}
#undef ifQ
#undef ifU
};

// Supports query
template<class B, class T, class F1, class F2>
auto make_Q_segment_tree_dynamic(B low, B high, F1 T_init, F2 TT, T T_id){
	using U = int;
	auto _UU = [&](U, U)->U{ return U{}; };
	auto _UT = [&](U, T)->T{ return T{}; };
	return segment_tree_dynamic_base<true, false, B, T, U, F1, F2, decltype(_UU), decltype(_UT)>(low, high, T_init, TT, T_id, _UU, U{}, _UT);
}
// Supports query
template<class B, class T, class F>
auto make_Q_segment_tree_dynamic(B low, B high, F TT, T T_id){
	auto _T_init = [T_id](B, B){ return T_id; };
	return make_Q_segment_tree_dynamic<B, T, decltype(_T_init), F>(low, high, move(_T_init), TT, T_id);
}
// Supports update
template<class B, class U, class F>
auto make_U_segment_tree_dynamic(B low, B high, F UU, U U_id){
	using T = int;
	auto _T_init = [&](B, B)->T{ return T{}; };
	auto _TT = [&](T, T)->T{ return T{}; };
	auto _UT = [&](U, T)->T{ return T{}; };
	return segment_tree_dynamic_base<false, true, B, T, U, decltype(_T_init), decltype(_TT), F, decltype(_UT)>(low, high, _T_init, _TT, T{}, UU, U_id, _UT);
}
// Supports query and update
template<class B, class T, class U, class F1, class F2, class F3, class F4>
auto make_QU_segment_tree_dynamic(B low, B high, F1 T_init, F2 TT, T T_id, F3 UU, U U_id, F4 UT){
	return segment_tree_dynamic_base<true, true, B, T, U, F1, F2, F3, F4>(low, high, T_init, TT, T_id, UU, U_id, UT);
}
// Supports query and update
template<class B, class T, class U, class F1, class F2, class F3>
auto make_QU_segment_tree_dynamic(B low, B high, F1 TT, T T_id, F2 UU, U U_id, F3 UT){
	auto _T_init = [T_id](B, B){ return T_id; };
	return make_QU_segment_tree_dynamic<B, T, U, decltype(_T_init), F1, F2, F3>(low, high, _T_init, TT, T_id, UU, U_id, UT);
}

int main(){
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(ios::badbit | ios::failbit);
	cout << fixed << setprecision(7);
	using T = array<int, 2>;
	auto T_init = [&](int l, int r)->T{
		return {0, r - l};
	};
	auto TT = [&](T x, T y)->T{
		return x[0] < y[0] ? x : x[0] > y[0] ? y : T{x[0], x[1] + y[1]};
	};
	T T_id{};
	auto UT = [&](int f, T x)->T{
		return {
			x[0] + f,
			x[1]
		};
	};
	int n, len;
	cin >> n >> len;
	auto seg = make_QU_segment_tree_dynamic(0, len + 1, [&](int l, int r){ return array{0, r - l}; }, TT, T_id, plus<>(), 0, UT);
	set<array<int, 2>> s;
	for(auto i = 0; i < n; ++ i){
		int x, y;
		cin >> x >> y;
		if(s.contains({x, y})){
			seg.update(max(0, x - y), min(len, x + y), -1);
			s.erase({x, y});
		}
		else{
			seg.update(max(0, x - y), min(len, x + y), 1);
			s.insert({x, y});
		}
		cout << (len + 1 - seg.query_all()[1]) * sqrt(2) << "\n";
	}
	return 0;
}

/*

*/

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3892kb

input:

3 10
3 2
7 3
9 6

output:

5.6568542
12.7279221
12.7279221

result:

ok 3 numbers

Test #2:

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

input:

5 100
31 41
59 26
31 41
59 26
31 41

output:

101.8233765
120.2081528
73.5391052
0.0000000
101.8233765

result:

ok 5 numbers

Test #3:

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

input:

100 10
6 4
2 3
7 6
5 5
3 6
7 5
5 8
10 4
9 8
0 9
9 10
9 3
2 3
10 10
8 4
10 9
0 1
1 7
0 2
3 4
10 3
3 10
7 4
7 5
1 4
0 7
1 9
5 6
8 8
7 4
8 1
3 9
2 1
5 5
2 1
10 9
8 4
0 9
10 7
4 1
9 10
8 6
5 4
1 4
0 9
9 3
4 8
5 10
7 2
8 10
7 10
3 4
2 2
8 5
0 9
5 3
1 4
6 4
0 3
8 1
1 6
3 8
8 4
6 5
10 2
2 2
8 4
6 1
2 4
6 4...

output:

11.3137085
14.1421356
14.1421356
14.1421356
14.1421356
14.1421356
14.1421356
14.1421356
14.1421356
14.1421356
14.1421356
14.1421356
14.1421356
14.1421356
14.1421356
14.1421356
14.1421356
14.1421356
14.1421356
14.1421356
14.1421356
14.1421356
14.1421356
14.1421356
14.1421356
14.1421356
14.1421356
14....

result:

ok 100 numbers

Test #4:

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

input:

1000 100
95 8
54 8
64 96
47 34
77 47
99 91
45 70
8 6
64 84
48 42
53 14
73 66
38 27
6 52
19 75
33 39
6 24
37 80
27 45
96 48
55 95
67 1
23 78
40 4
76 7
77 22
4 47
41 31
60 54
96 37
79 52
63 40
7 92
17 7
74 12
93 16
87 5
67 43
60 29
71 58
52 41
53 84
38 2
46 87
13 54
54 14
16 93
57 7
91 98
31 23
70 3
9...

output:

18.3847763
41.0121933
141.4213562
141.4213562
141.4213562
141.4213562
141.4213562
141.4213562
141.4213562
141.4213562
141.4213562
141.4213562
141.4213562
141.4213562
141.4213562
141.4213562
141.4213562
141.4213562
141.4213562
141.4213562
141.4213562
141.4213562
141.4213562
141.4213562
141.4213562
14...

result:

ok 1000 numbers

Test #5:

score: 0
Accepted
time: 2ms
memory: 4112kb

input:

1000 1000
942 407
513 739
329 437
605 318
847 416
128 543
588 237
903 365
703 556
313 928
621 344
974 444
780 265
993 889
103 427
94 977
897 586
566 326
785 938
224 952
150 441
716 802
729 584
954 347
640 4
91 633
738 970
823 253
158 890
115 734
327 391
554 258
373 67
396 995
788 73
609 703
627 801
...

output:

657.6093065
1414.2135624
1414.2135624
1414.2135624
1414.2135624
1414.2135624
1414.2135624
1414.2135624
1414.2135624
1414.2135624
1414.2135624
1414.2135624
1414.2135624
1414.2135624
1414.2135624
1414.2135624
1414.2135624
1414.2135624
1414.2135624
1414.2135624
1414.2135624
1414.2135624
1414.2135624
14...

result:

ok 1000 numbers

Test #6:

score: 0
Accepted
time: 115ms
memory: 3984kb

input:

200000 10
6 4
4 9
7 9
6 2
0 7
6 7
4 8
10 5
7 8
5 4
3 6
5 9
0 9
7 3
8 2
8 6
5 9
5 10
4 9
0 3
10 5
3 9
7 2
2 3
9 7
5 6
1 7
0 4
9 6
4 7
3 8
6 4
2 7
0 6
8 3
6 2
8 10
1 6
0 4
6 1
3 3
5 8
9 7
8 7
1 10
6 2
1 8
8 6
6 1
6 3
0 6
6 1
5 6
1 1
6 4
7 9
3 5
10 6
2 8
6 7
7 3
6 8
8 5
9 7
4 5
6 4
5 10
8 6
8 5
4 6
4 6...

output:

11.3137085
14.1421356
14.1421356
14.1421356
14.1421356
14.1421356
14.1421356
14.1421356
14.1421356
14.1421356
14.1421356
14.1421356
14.1421356
14.1421356
14.1421356
14.1421356
14.1421356
14.1421356
14.1421356
14.1421356
14.1421356
14.1421356
14.1421356
14.1421356
14.1421356
14.1421356
14.1421356
14....

result:

ok 200000 numbers

Test #7:

score: 0
Accepted
time: 158ms
memory: 4100kb

input:

200000 100
96 9
26 82
73 33
12 92
13 77
87 2
23 79
41 91
75 28
6 45
42 81
27 51
7 64
80 90
27 65
77 72
54 60
79 8
10 61
46 15
65 16
75 95
65 4
89 38
42 74
96 63
48 87
39 78
2 59
36 48
36 66
12 75
44 45
80 86
79 99
26 30
29 54
39 44
7 27
99 23
41 76
23 71
76 51
90 76
59 22
45 70
73 98
24 94
70 54
76 ...

output:

18.3847763
141.4213562
141.4213562
141.4213562
141.4213562
141.4213562
141.4213562
141.4213562
141.4213562
141.4213562
141.4213562
141.4213562
141.4213562
141.4213562
141.4213562
141.4213562
141.4213562
141.4213562
141.4213562
141.4213562
141.4213562
141.4213562
141.4213562
141.4213562
141.4213562
1...

result:

ok 200000 numbers

Test #8:

score: 0
Accepted
time: 258ms
memory: 13360kb

input:

200000 10000
8596 2507
1107 4452
8591 3460
3584 2911
8817 9663
1604 2760
6281 8431
5271 4811
2193 1874
5329 3970
2679 8672
8426 8447
117 4849
3471 6286
177 4806
9726 7217
6743 3882
573 4295
5291 7358
1356 6269
7882 8426
8750 985
5365 8276
7420 6372
8234 6329
7723 9014
3369 1097
7140 8329
3475 447
37...

output:

5530.9892424
13392.6024357
14142.1356237
14142.1356237
14142.1356237
14142.1356237
14142.1356237
14142.1356237
14142.1356237
14142.1356237
14142.1356237
14142.1356237
14142.1356237
14142.1356237
14142.1356237
14142.1356237
14142.1356237
14142.1356237
14142.1356237
14142.1356237
14142.1356237
14142.1...

result:

ok 200000 numbers

Test #9:

score: 0
Accepted
time: 573ms
memory: 153988kb

input:

200000 1000000000
979065421 937279323
384811311 879649222
673927841 883688174
47686221 518846247
805783947 475892423
94359891 104324315
116498230 496486640
155617000 261326127
423462080 949904263
758478482 824824842
594993542 173897699
495194886 158960628
409812195 339201236
958417812 891558399
7055...

output:

1355119095.8628440
1414213562.3730950
1414213562.3730950
1414213562.3730950
1414213562.3730950
1414213562.3730950
1414213562.3730950
1414213562.3730950
1414213562.3730950
1414213562.3730950
1414213562.3730950
1414213562.3730950
1414213562.3730950
1414213562.3730950
1414213562.3730950
1414213562.3730...

result:

ok 200000 numbers

Test #10:

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

input:

3 100
82 61
46 1
82 61

output:

111.7228714
111.7228714
2.8284271

result:

ok 3 numbers

Test #11:

score: 0
Accepted
time: 223ms
memory: 21332kb

input:

200000 200005
199999 1
199998 2
199997 3
199996 4
199995 5
199994 6
199993 7
199992 8
199991 9
199990 10
199989 11
199988 12
199987 13
199986 14
199985 15
199984 16
199983 17
199982 18
199981 19
199980 20
199979 21
199978 22
199977 23
199976 24
199975 25
199974 26
199973 27
199972 28
199971 29
19997...

output:

2.8284271
5.6568542
8.4852814
11.3137085
14.1421356
16.9705627
19.7989899
22.6274170
25.4558441
28.2842712
31.1126984
33.9411255
36.7695526
39.5979797
42.4264069
45.2548340
48.0832611
50.9116882
53.7401154
56.5685425
59.3969696
62.2253967
65.0538239
67.8822510
70.7106781
73.5391052
76.3675324
79.195...

result:

ok 200000 numbers

Test #12:

score: 0
Accepted
time: 217ms
memory: 20616kb

input:

200000 200005
0 200000
1 199999
2 199998
3 199997
4 199996
5 199995
6 199994
7 199993
8 199992
9 199991
10 199990
11 199989
12 199988
13 199987
14 199986
15 199985
16 199984
17 199983
18 199982
19 199981
20 199980
21 199979
22 199978
23 199977
24 199976
25 199975
26 199974
27 199973
28 199972
29 199...

output:

282842.7124746
282842.7124746
282842.7124746
282842.7124746
282842.7124746
282842.7124746
282842.7124746
282842.7124746
282842.7124746
282842.7124746
282842.7124746
282842.7124746
282842.7124746
282842.7124746
282842.7124746
282842.7124746
282842.7124746
282842.7124746
282842.7124746
282842.7124746
...

result:

ok 200000 numbers

Test #13:

score: 0
Accepted
time: 300ms
memory: 20576kb

input:

200000 200005
188054 11946
25503 174497
5164 194836
199742 258
65650 134350
93448 106552
165510 34490
33001 166999
54081 145919
123066 76934
50244 149756
46561 153439
66523 133477
8593 191407
173633 26367
105494 94506
198495 1505
75564 124436
83182 116818
123337 76663
186899 13101
110487 89513
10858...

output:

33788.3904322
282842.7124746
282842.7124746
282842.7124746
282842.7124746
282842.7124746
282842.7124746
282842.7124746
282842.7124746
282842.7124746
282842.7124746
282842.7124746
282842.7124746
282842.7124746
282842.7124746
282842.7124746
282842.7124746
282842.7124746
282842.7124746
282842.7124746
2...

result:

ok 200000 numbers

Test #14:

score: 0
Accepted
time: 216ms
memory: 21920kb

input:

200000 200005
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
21 21
22 22
23 23
24 24
25 25
26 26
27 27
28 28
29 29
30 30
31 31
32 32
33 33
34 34
35 35
36 36
37 37
38 38
39 39
40 40
41 41
42 42
43 43
44 44
45 45
46 46
47 47
48 48
49 49
50 50
51 5...

output:

2.8284271
5.6568542
8.4852814
11.3137085
14.1421356
16.9705627
19.7989899
22.6274170
25.4558441
28.2842712
31.1126984
33.9411255
36.7695526
39.5979797
42.4264069
45.2548340
48.0832611
50.9116882
53.7401154
56.5685425
59.3969696
62.2253967
65.0538239
67.8822510
70.7106781
73.5391052
76.3675324
79.195...

result:

ok 200000 numbers

Test #15:

score: 0
Accepted
time: 202ms
memory: 22700kb

input:

200000 200005
200000 200000
199999 199999
199998 199998
199997 199997
199996 199996
199995 199995
199994 199994
199993 199993
199992 199992
199991 199991
199990 199990
199989 199989
199988 199988
199987 199987
199986 199986
199985 199985
199984 199984
199983 199983
199982 199982
199981 199981
199980...

output:

282849.7835424
282849.7835424
282849.7835424
282849.7835424
282849.7835424
282849.7835424
282849.7835424
282849.7835424
282849.7835424
282849.7835424
282849.7835424
282849.7835424
282849.7835424
282849.7835424
282849.7835424
282849.7835424
282849.7835424
282849.7835424
282849.7835424
282849.7835424
...

result:

ok 200000 numbers

Test #16:

score: 0
Accepted
time: 293ms
memory: 21932kb

input:

200000 200005
99686 99686
193692 193692
142065 142065
56279 56279
120521 120521
147618 147618
148660 148660
1328 1328
69007 69007
5297 5297
136306 136306
136195 136195
101372 101372
66966 66966
110843 110843
170697 170697
23097 23097
146157 146157
118098 118098
11530 11530
42300 42300
74535 74535
17...

output:

281954.5863574
282849.7835424
282849.7835424
282849.7835424
282849.7835424
282849.7835424
282849.7835424
282849.7835424
282849.7835424
282849.7835424
282849.7835424
282849.7835424
282849.7835424
282849.7835424
282849.7835424
282849.7835424
282849.7835424
282849.7835424
282849.7835424
282849.7835424
...

result:

ok 200000 numbers

Test #17:

score: 0
Accepted
time: 187ms
memory: 3856kb

input:

200000 1000000000
227478108 704821317
227478108 704821317
227478108 704821317
227478108 704821317
227478108 704821317
227478108 704821317
227478108 704821317
227478108 704821317
227478108 704821317
227478108 704821317
227478108 704821317
227478108 704821317
227478108 704821317
227478108 704821317
22...

output:

1318470491.0276382
0.0000000
1318470491.0276382
0.0000000
1318470491.0276382
0.0000000
1318470491.0276382
0.0000000
1318470491.0276382
0.0000000
1318470491.0276382
0.0000000
1318470491.0276382
0.0000000
1318470491.0276382
0.0000000
1318470491.0276382
0.0000000
1318470491.0276382
0.0000000
1318470491...

result:

ok 200000 numbers

Test #18:

score: 0
Accepted
time: 255ms
memory: 3940kb

input:

200000 1000000000
517510913 200230004
39507125 601409920
30526823 972694998
176712 534697072
789676092 648567171
967127462 822743807
176712 534697072
176712 534697072
117560602 867751869
967127462 822743807
227002346 310628813
789676092 648567171
800983841 618498638
39507125 601409920
517510913 2002...

output:

566335974.5016382
1015038939.0915020
1414213562.3730950
1414213562.3730950
1414213562.3730950
1414213562.3730950
1414213562.3730950
1414213562.3730950
1414213562.3730950
1414213562.3730950
1414213562.3730950
1414213562.3730950
1414213562.3730950
1414213562.3730950
1414213562.3730950
1414213562.37309...

result:

ok 200000 numbers

Test #19:

score: 0
Accepted
time: 284ms
memory: 4052kb

input:

200000 1000000000
351451808 649636951
49985291 500589827
661773922 164694264
186065541 226295124
497991267 744030929
574182692 439989249
853617452 979655888
308109763 216029731
66584658 40643821
855305206 820425533
740812379 441059394
151159173 495945962
214589103 777995590
957581330 407536966
88513...

output:

1414213562.3730950
1414213562.3730950
1414213562.3730950
1414213562.3730950
1414213562.3730950
1414213562.3730950
1414213562.3730950
1414213562.3730950
1414213562.3730950
1414213562.3730950
1414213562.3730950
1414213562.3730950
1414213562.3730950
1414213562.3730950
1414213562.3730950
1414213562.3730...

result:

ok 200000 numbers

Test #20:

score: 0
Accepted
time: 285ms
memory: 3792kb

input:

200000 1000000000
821475126 617812186
464369722 134670005
821475126 617812186
464369722 134670005
464369722 134670005
821475126 617812186
464369722 134670005
464369722 134670005
464369722 134670005
464369722 134670005
821475126 617812186
464369722 134670005
464369722 134670005
464369722 134670005
46...

output:

1126190670.4723172
1126190670.4723172
380904295.0317051
0.0000000
380904295.0317051
1126190670.4723172
1126190670.4723172
1126190670.4723172
1126190670.4723172
1126190670.4723172
380904295.0317051
0.0000000
380904295.0317051
0.0000000
380904295.0317051
1126190670.4723172
380904295.0317051
0.0000000
...

result:

ok 200000 numbers

Test #21:

score: 0
Accepted
time: 115ms
memory: 3844kb

input:

200000 11
1 1
2 1
3 1
4 1
5 1
6 1
7 1
8 1
9 1
10 1
8 1
10 10
3 1
1 2
9 10
1 4
5 1
1 5
1 6
7 7
2 1
4 1
5 3
7 9
6 4
3 7
6 1
1 8
2 5
2 9
10 9
6 10
9 8
1 2
7 3
6 6
6 6
7 5
1 9
7 9
3 5
9 5
3 3
6 8
10 9
7 5
5 1
2 1
3 2
5 5
8 1
4 9
9 8
1 3
4 8
8 9
2 10
1 4
7 3
4 1
1 2
1 2
5 1
5 4
1 3
2 1
6 2
6 8
5 9
10 7
5...

output:

2.8284271
4.2426407
5.6568542
7.0710678
8.4852814
9.8994949
11.3137085
12.7279221
14.1421356
15.5563492
15.5563492
15.5563492
15.5563492
15.5563492
15.5563492
15.5563492
15.5563492
15.5563492
15.5563492
15.5563492
15.5563492
15.5563492
15.5563492
15.5563492
15.5563492
15.5563492
15.5563492
15.556349...

result:

ok 200000 numbers

Test #22:

score: 0
Accepted
time: 78ms
memory: 3876kb

input:

200000 4
1 1
2 1
3 1
1 1
3 2
3 3
2 1
3 3
2 1
2 2
2 2
3 1
2 2
3 3
1 2
2 3
1 2
2 1
2 2
1 2
3 1
2 2
2 1
2 1
3 3
2 2
1 2
1 3
2 1
3 3
2 3
3 1
2 1
1 2
1 3
3 1
2 3
2 1
1 2
3 3
1 3
3 3
2 3
2 3
2 1
3 1
3 3
1 2
2 1
2 1
1 1
1 3
1 1
1 1
2 3
2 2
1 2
1 1
1 3
1 1
1 2
1 1
2 3
1 1
2 2
2 2
2 1
2 1
3 2
1 1
3 1
1 2
1 1...

output:

2.8284271
4.2426407
5.6568542
4.2426407
4.2426407
5.6568542
5.6568542
4.2426407
4.2426407
5.6568542
4.2426407
4.2426407
5.6568542
5.6568542
5.6568542
5.6568542
5.6568542
5.6568542
5.6568542
5.6568542
5.6568542
5.6568542
5.6568542
5.6568542
5.6568542
5.6568542
5.6568542
5.6568542
5.6568542
5.6568542
...

result:

ok 200000 numbers

Test #23:

score: 0
Accepted
time: 141ms
memory: 4092kb

input:

200000 51
1 1
2 1
3 1
4 1
5 1
6 1
7 1
8 1
9 1
10 1
11 1
12 1
13 1
14 1
15 1
16 1
17 1
18 1
19 1
20 1
21 1
22 1
23 1
24 1
25 1
26 1
27 1
28 1
29 1
30 1
31 1
32 1
33 1
34 1
35 1
36 1
37 1
38 1
39 1
40 1
41 1
42 1
43 1
44 1
45 1
46 1
47 1
48 1
49 1
50 1
2 47
25 41
44 8
35 38
37 24
42 32
40 48
19 4
26 4...

output:

2.8284271
4.2426407
5.6568542
7.0710678
8.4852814
9.8994949
11.3137085
12.7279221
14.1421356
15.5563492
16.9705627
18.3847763
19.7989899
21.2132034
22.6274170
24.0416306
25.4558441
26.8700577
28.2842712
29.6984848
31.1126984
32.5269119
33.9411255
35.3553391
36.7695526
38.1837662
39.5979797
41.012193...

result:

ok 200000 numbers