QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#941497#1814. Kingdoms and Quarantinefast_photonAC ✓496ms28684kbC++176.0kb2025-03-18 15:37:192025-03-18 15:37:19

Judging History

This is the latest submission verdict.

  • [2025-03-18 15:37:19]
  • Judged
  • Verdict: AC
  • Time: 496ms
  • Memory: 28684kb
  • [2025-03-18 15:37:19]
  • Submitted

answer

#include<iostream>
#include<cstdio>
#include<fstream>
#include<queue>
#include<algorithm>
#include<cstring>
#include<map>
#define fi first
#define se second
#define maxn 100005
#define maxm 300005
#define fopen(x, y) freopen(x".in", "r", stdin); freopen(y".out", "w", stdout);
#define int long long
#ifdef int
#define inf 0x3f3f3f3f3f3f3f3fll
#else
#define inf 0x3f3f3f3f
#endif

using namespace std;

struct Graph {
	struct Edge {
		int u, v, w, s, next;
	} e[maxm];
	struct Info {
		int fl, cs;
		Info(int _fl = 0, int _cs = 0) : fl(_fl), cs(_cs) {}
		Info operator+(Info b) const {
			return Info(fl + b.fl, cs + b.cs);
		}
		Info& operator+=(Info b) { return (*this = *this + b); }
	};
	int h[maxn], now[maxn], dis[maxn], vis[maxn], n, en, s, t;
	void clear() {
		memset(h, 0xff, sizeof(h));
		memset(now, 0xff, sizeof(now));
		n = en = s = t = 0;
	}
	Graph() {
		clear();
	}
	void add(int u, int v, int w, int s, int _s = 0) {
		e[en] = (Edge){ u, v, w, s, h[u] }; h[u] = en++;
		e[en] = (Edge){ v, u, -w, _s, h[v] }; h[v] = en++;
		n = max(n, max(u, v));
	}
	bool spfa() {
		queue<int> q;
		for(int i = 0; i <= n; i++) {
			dis[i] = inf; vis[i] = 0;
		}
		dis[s] = 0; q.push(s); now[s] = h[s];
		while(!q.empty()) {
			int r = q.front(); q.pop();
			for(int j = h[r]; ~j; j = e[j].next) {
				int v = e[j].v;
				if(dis[v] > dis[r] + e[j].w && e[j].s) {
					dis[v] = dis[r] + e[j].w;
					q.push(v);
					now[v] = h[v];
				}
			}
		}
		return dis[t] < inf;
	}
	Info dinic(int r, int lft = inf) {
		if(r == t) return Info(lft, 0);
		vis[r] = 1;
		Info sum, k;
		for(int j = h[r]; ~j; j = e[j].next) {
			int v = e[j].v;
			if(dis[v] != dis[r] + e[j].w || vis[v] || !e[j].s) continue;
			k = dinic(v, min(lft, e[j].s));
			if(k.fl == 0) dis[v] = inf;
			sum += k; lft -= k.fl;
			e[j].s -= k.fl; e[j ^ 1].s += k.fl;
			sum.cs += e[j].w * k.fl;
			if(!lft) break;
		}
		return sum;
	}
	Info stream(int _s, int _t) {
		s = _s, t = _t;
		Info res;
		while(spfa()) {
			res += dinic(_s);
		}
		return res;
	}
	Info stream2(int _s, int _t) {
		s = _s, t = _t;
		Info res;
		while(spfa() && dis[t] < 0) {
			res += dinic(_s);
		}
		return res;
	}
} f, g; 

int n1, n2, n, m, deg[maxn], u[maxm], v[maxm], a[maxn], b[maxn], fa[maxn], vis[maxn], id[maxn], od[maxn];

int x, y;

queue<pair<int, int> > tdl;

map<int, queue<int> > q[3005];

bool dfs(int r) {
//	cout << "dfs " << r << '\n';
	vis[r] = 2;
	for(int j = f.h[r]; ~j; j = f.e[j].next) {
		if(!f.e[j].s || f.e[j].w < 0) continue;
		int v = f.e[j].v; 
		if(!vis[v]) {
			fa[v] = r;
			if(dfs(v)) {
				if(y) {
					f.e[j].s = 0;
					tdl.push(make_pair(r, v));
				}
				if(r == x) y = 0;
				vis[r] = 1;
				return true;
			}
		}
		else if(vis[v] == 2) {
//			cout << r << " lnk " << v << '\n';
			x = v, y = 1; 
			f.e[j].s = 0;
			tdl.push(make_pair(r, v));
			vis[r] = 1;
			return true;
		}
	}
	vis[r] = 1;
	return false;
}
bool dfs2(int r) {
	if(od[r] == 0) return true;
	vis[r] = 1;
	for(int j = f.h[r]; ~j; j = f.e[j].next) {
		if(!f.e[j].s || f.e[j].w < 0) continue;
		int v = f.e[j].v;
		if(!vis[v]) {
			fa[v] = r;
			if(dfs2(v)) {
				f.e[j].s = 0;
				tdl.push(make_pair(r, v));
				return true;
			}
		}
	}
	return false;
}

void work() {
	cin >> n1 >> n2 >> m;
	n = n1 + n2;
//	for(int i = 1; i <= n; i++) cin >> b[i];
	for(int i = 1; i <= m; i++) {
		cin >> u[i] >> v[i];
		q[u[i]][v[i]].push(i);
		deg[u[i]] ^= 1, deg[v[i]] ^= 1;
	}
//	for(int i = 1; i <= n; i++) deg[i] = b[i];
	for(int i = 1; i <= m; i++) {
		if(deg[u[i]] == deg[v[i]]) g.add(v[i], u[i], 1, 1), a[u[i]]--, a[v[i]]++;
		else g.add(u[i], v[i], 1, 1), a[v[i]]--, a[u[i]]++;
	}
	for(int i = 1; i <= n; i++) {
		if(i <= n1) g.add(n + 1, i, 0, 1);
		else g.add(i, n + 2, 0, 1); 
	}
	int mxf = 0;
	for(int i = 1; i <= n + 2; i++) {
		if(a[i] > 0) {
			g.add(n + 3, i, 0, a[i]);
			mxf += a[i];
		}
		if(a[i] < 0) {
			g.add(i, n + 4, 0, -a[i]);
		}
	}
	g.add(n + 2, n + 1, 0, inf);
	Graph::Info s1 = g.stream(n + 3, n + 4);
	if(s1.fl != mxf) {
		cout << "Err s1 != mxf\n";
		exit(0);
	}
	s1.fl = g.e[g.en - 2].s;
	g.e[g.en - 1].s = 0;
	Graph::Info s2 = g.stream2(n + 1, n + 2);
	int res = m - (s1.cs + s2.cs);
	cout << res << '\n';
	for(int i = 0; i < g.en; i += 2) {
		if(g.e[i].s == 1 && g.e[i].u <= n && g.e[i].v <= n) {
			int u = g.e[i].u, v = g.e[i].v;
			f.add(v, u, 1, 1);
//			cout << v << "->" << u << '\n';
			id[u]++; od[v]++;
		}
	}
	for(int t = 1; t <= 3000; t++) {
		memset(vis, 0, sizeof(vis));
		x = y = 0;
		for(int i = 1; i <= n; i++) {
			if(id[i] >= 1 && od[i] >= 1) {
//				cout << "try " << i << endl;
				if(dfs(i)) break;
			}
		}
		vector<int> op[2];
		int p = 0;
		while(!tdl.empty()) {
			int u = tdl.front().fi, v = tdl.front().se;
			od[u]--, id[v]--;
			tdl.pop();
//			cout << u << "~" << v << '\n';
			if(u > v) swap(u, v);
			op[p].push_back(q[u][v].front()); q[u][v].pop();
			p ^= 1; 
		}
		if(!op[0].size()) continue;
//		cout << "A+";
		if(deg[u[op[0][0]]] != deg[v[op[0][0]]]) swap(op[0], op[1]);
		for(int x : op[0]) cout << x << ' '; for(int x : op[1]) cout << x << ' '; 
//		cout << '\n';
	}
	for(int t = 1; t <= 3000; t++) {
		memset(vis, 0, sizeof(vis));
//		for(int i = 1; i <= n; i++) {
//			cout << id[i] << ' ';
//		} cout << '\n';
		for(int i = 1; i <= n; i++) {
			if(id[i] == 0 && od[i] > 0) {
//				cout << "try " << i << '\n';
				if(dfs2(i)) break;
			}
		}
		vector<int> op[2];
		int p = 0;
		while(!tdl.empty()) {
			int u = tdl.front().fi, v = tdl.front().se;
			od[u]--, id[v]--;
//			cout << u << ' ' << v << '\n';
			tdl.pop();
			if(u > v) swap(u, v);
			op[p].push_back(q[u][v].front()); q[u][v].pop();
			p ^= 1; 
		}
		if(!op[0].size()) continue;
//		cout << "A+";
		for(int x : op[0]) cout << x << ' '; for(int x : op[1]) cout << x << ' '; //cout << '\n'; 
	}
}

signed main() {
	ios::sync_with_stdio(false); cin.tie(0);
	int _ = 1;
//	cin >> _;
	while(_--) work();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 71ms
memory: 20484kb

input:

2 3 5
1 3
1 4
1 5
2 4
2 5

output:

3
1 4 2 

result:

ok accepted

Test #2:

score: 0
Accepted
time: 70ms
memory: 22512kb

input:

1 2 2
1 2
1 3

output:

0

result:

ok accepted

Test #3:

score: 0
Accepted
time: 71ms
memory: 24328kb

input:

4 3 7
1 5
2 5
2 6
2 7
3 6
4 5
4 7

output:

5
7 2 4 6 1 

result:

ok accepted

Test #4:

score: 0
Accepted
time: 71ms
memory: 20272kb

input:

10 10 20
2 11
2 17
1 12
8 14
9 15
10 12
9 13
1 18
3 15
2 14
2 16
7 13
8 15
8 20
9 12
6 13
8 16
6 11
4 20
6 16

output:

11
20 1 11 18 14 9 13 12 4 5 6 

result:

ok accepted

Test #5:

score: 0
Accepted
time: 72ms
memory: 22448kb

input:

10 10 30
8 18
9 12
10 19
10 14
2 16
1 11
6 13
1 18
4 12
9 13
4 20
8 16
2 20
5 20
7 14
3 15
5 18
2 12
4 15
5 17
4 18
5 19
7 17
3 16
7 19
8 19
1 19
10 18
10 12
3 18

output:

21
17 27 8 22 29 26 21 13 18 3 1 11 6 24 19 16 20 2 25 4 15 

result:

ok accepted

Test #6:

score: 0
Accepted
time: 70ms
memory: 20580kb

input:

10 10 50
10 12
3 20
7 20
8 19
5 17
6 16
10 13
10 15
3 15
4 17
4 19
9 19
10 16
1 17
9 18
3 17
6 11
8 12
8 20
9 11
6 20
2 14
6 12
7 11
5 15
7 15
7 17
10 18
5 18
4 12
4 18
7 16
4 20
10 19
1 18
7 12
8 16
8 11
2 18
8 13
2 19
1 16
8 17
6 19
9 15
2 12
10 11
6 14
2 11
7 14

output:

22
13 44 6 34 33 23 21 30 20 8 45 47 50 17 24 48 9 3 37 22 15 39 

result:

ok accepted

Test #7:

score: 0
Accepted
time: 71ms
memory: 24352kb

input:

10 10 100
7 18
10 12
2 20
3 16
5 14
2 13
10 16
2 15
8 15
3 15
7 16
6 15
3 18
1 19
6 14
1 14
2 11
9 13
5 11
5 13
5 20
7 13
9 11
7 12
10 13
1 11
6 19
5 19
4 11
4 13
10 15
6 17
1 16
3 19
3 14
4 20
2 12
4 14
8 16
1 12
6 20
3 11
9 15
7 17
7 20
9 17
10 20
1 20
4 19
2 17
6 12
9 12
4 12
1 15
3 13
9 20
3 17
...

output:

10
14 3 4 29 5 32 1 9 18 2 

result:

ok accepted

Test #8:

score: 0
Accepted
time: 74ms
memory: 26512kb

input:

60 60 200
40 91
35 64
3 105
48 110
4 115
36 77
2 104
14 111
43 68
23 112
37 62
40 68
57 106
22 95
9 89
29 69
24 101
52 75
26 63
60 115
50 118
26 93
30 73
38 116
54 97
55 76
10 97
8 82
1 74
29 89
27 72
33 102
7 86
51 77
4 63
40 109
6 97
1 120
39 102
53 89
2 78
35 109
22 107
47 89
44 106
44 105
46 120...

output:

101
148 59 133 140 178 36 33 41 74 185 83 29 38 14 5 117 154 71 146 158 46 72 19 193 3 144 189 22 180 112 23 26 35 142 124 151 162 141 15 119 90 96 137 132 51 91 106 82 77 134 9 135 163 63 69 105 12 49 99 68 102 167 56 108 130 195 164 156 1 109 198 174 42 44 64 184 150 53 94 149 61 67 21 97 30 168 1...

result:

ok accepted

Test #9:

score: 0
Accepted
time: 74ms
memory: 18840kb

input:

60 60 500
17 63
3 65
31 120
58 94
36 76
14 120
54 96
30 97
43 119
53 67
41 75
59 84
49 70
11 81
27 70
2 105
44 94
13 115
16 97
3 95
19 83
2 89
29 119
16 77
26 99
25 115
25 93
43 84
43 61
45 105
38 69
24 100
16 118
33 73
6 101
17 67
10 84
49 73
45 118
48 92
22 93
1 111
8 72
19 107
23 95
1 112
21 108
...

output:

319
430 350 481 485 418 389 394 451 420 174 129 488 309 461 20 346 463 198 412 448 120 351 324 459 391 464 334 1 500 246 367 359 140 268 337 390 271 484 460 357 315 312 79 474 449 109 191 180 383 285 46 178 446 423 380 382 482 406 494 435 441 387 354 176 477 498 217 307 468 439 386 99 371 222 5 127 ...

result:

ok accepted

Test #10:

score: 0
Accepted
time: 81ms
memory: 21192kb

input:

60 60 1000
60 94
5 71
53 115
22 61
8 65
38 62
51 63
26 68
40 94
16 63
24 100
54 98
28 86
41 96
47 101
42 75
56 100
29 89
1 110
23 71
60 73
36 74
12 95
3 106
18 77
4 65
49 83
3 83
26 117
24 103
59 85
36 63
8 96
8 101
26 114
37 69
24 89
19 80
36 100
54 89
22 75
3 89
31 119
33 62
58 69
38 114
39 81
54 ...

output:

691
921 887 616 939 863 978 902 692 970 739 995 527 696 769 560 964 875 996 547 857 890 658 783 928 917 976 896 825 621 955 500 805 945 750 959 866 968 485 963 982 604 936 909 962 979 707 937 967 685 598 781 861 305 764 203 759 947 1000 358 860 399 762 676 832 754 789 792 664 935 718 635 924 406 657...

result:

ok accepted

Test #11:

score: 0
Accepted
time: 89ms
memory: 25752kb

input:

60 60 2000
40 120
9 78
35 69
18 102
19 117
22 84
4 72
53 68
49 73
16 107
50 93
16 80
35 72
31 112
9 67
47 97
35 65
14 96
49 111
48 117
55 104
43 97
17 74
9 76
45 114
38 117
18 112
11 114
58 72
3 116
32 95
38 113
10 104
17 93
36 94
16 106
17 84
43 61
46 61
20 62
22 72
18 73
3 118
22 70
44 68
34 75
47...

output:

1282
1876 1655 1818 1649 1330 2000 1592 1904 1564 1926 1489 1853 1815 1714 1752 1986 1975 1426 1870 1946 1827 1862 1467 1721 1861 1895 1025 1699 1556 1704 1954 1857 1147 1949 1495 1691 1757 1906 1528 1922 1977 1718 1458 1141 1746 1846 1724 828 1987 1897 1940 1908 1657 1665 1890 1934 1925 1679 1786 1...

result:

ok accepted

Test #12:

score: 0
Accepted
time: 94ms
memory: 21808kb

input:

60 60 2000
53 65
55 77
46 75
31 82
12 72
49 100
46 105
20 80
5 90
31 77
54 76
37 84
38 68
14 70
47 93
10 120
57 94
54 107
53 74
37 120
9 96
23 84
18 83
31 69
57 82
11 67
52 65
9 88
5 65
51 90
19 96
56 117
29 89
24 83
13 82
26 76
51 73
23 86
52 108
12 71
26 62
51 100
41 100
5 66
56 75
10 87
16 72
47 ...

output:

1232
1746 1914 1541 1476 1815 1757 1819 1879 1990 1692 1955 1862 1860 1839 1362 1814 1925 1982 1760 1932 1180 1582 1852 1930 1797 1488 1916 1698 1906 1958 1959 578 1901 1875 1842 1883 1841 1776 1999 1015 1781 1880 1915 1570 1954 1636 1770 1574 1764 1778 1986 1175 893 1564 548 1826 1808 1557 1926 170...

result:

ok accepted

Test #13:

score: 0
Accepted
time: 105ms
memory: 21728kb

input:

60 60 2000
10 119
13 117
49 102
26 106
20 76
54 73
9 72
42 100
19 118
51 68
30 64
21 95
9 84
18 90
51 91
39 109
49 112
7 79
13 82
5 95
20 65
5 105
38 91
35 118
46 89
36 63
41 91
23 101
50 110
39 92
60 104
47 74
50 97
6 72
7 76
1 119
17 70
51 84
23 97
28 84
42 82
59 75
32 86
53 69
3 61
43 92
35 85
56...

output:

1578
1904 1137 1691 1937 1765 1879 1995 1746 1394 1862 1875 1530 1989 1898 1943 1631 1987 1580 1996 1872 1923 1911 1934 1657 1976 1767 1964 1975 1830 1944 1942 1592 1951 1877 1895 1240 1863 1393 1991 1665 1988 1905 1971 1790 1888 1945 1860 1666 1075 1586 1178 1864 1545 1766 1603 1963 1818 1760 1707 ...

result:

ok accepted

Test #14:

score: 0
Accepted
time: 126ms
memory: 24548kb

input:

60 60 3000
57 75
4 75
40 61
9 120
55 88
31 107
47 77
56 92
49 100
30 92
34 72
29 105
46 63
37 80
22 65
11 72
43 111
24 88
6 81
24 94
47 98
2 79
59 84
51 64
13 73
30 63
58 69
25 65
52 97
36 106
26 97
16 103
16 92
31 112
36 108
13 97
32 119
39 114
48 117
25 66
14 117
6 90
53 84
1 117
58 108
25 99
12 1...

output:

2810
2957 2821 2688 2932 2891 2809 2987 2983 2854 2770 2869 2964 2769 2768 2814 2884 2835 2681 2941 2905 2995 2658 2967 2859 2269 2440 2896 2678 2900 2870 2788 2927 2979 2754 2945 2860 2283 2820 2476 2856 2655 2816 2938 2976 2420 2999 2815 2989 2897 2937 2862 2837 2922 2559 2668 2563 2888 2734 2984 ...

result:

ok accepted

Test #15:

score: 0
Accepted
time: 111ms
memory: 26592kb

input:

60 60 3000
47 106
32 101
35 118
6 104
34 111
16 78
29 112
48 96
32 114
41 70
21 80
16 75
42 80
9 90
26 88
15 95
13 105
27 110
53 102
43 83
35 94
26 67
10 92
48 69
53 120
54 90
58 69
9 66
50 109
53 106
39 84
39 89
17 116
33 77
30 84
27 89
41 87
35 89
16 109
26 90
37 91
4 103
9 76
32 102
29 61
58 115
...

output:

2608
2966 2788 2844 2917 2961 2605 2523 2872 2987 2889 2936 2328 2504 2995 2842 2063 2963 2659 2622 2652 2783 2868 2929 2791 2852 2664 2799 2688 1628 2834 2941 2690 2675 2903 2521 2778 2699 2989 2974 1614 2492 2819 2614 2378 1604 2421 2964 2507 2943 2702 2908 2541 2945 2450 2625 2933 2918 2813 2651 ...

result:

ok accepted

Test #16:

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

input:

60 60 3000
30 116
60 66
30 87
8 84
6 61
58 96
26 89
60 86
15 91
7 89
13 104
56 104
33 105
37 72
2 88
8 107
56 65
29 77
15 103
3 115
18 67
52 65
40 71
38 98
36 85
18 102
59 86
26 101
24 67
2 71
56 69
55 72
57 79
32 65
12 114
36 81
55 97
41 113
15 89
7 84
59 113
53 71
57 99
44 99
4 101
36 68
13 78
7 1...

output:

2746
2930 2645 2780 2906 2977 2658 2561 2813 2975 3000 2927 2710 2816 2910 2951 2997 2831 2913 2772 2990 2864 2865 2960 2883 2908 2844 2761 2622 2949 2957 2760 2886 2540 2679 2964 2888 2626 2721 2542 2811 2712 2915 2963 2770 2495 2797 2767 2855 2853 2944 2999 2751 2849 1896 2575 2943 2932 2994 2993 ...

result:

ok accepted

Test #17:

score: 0
Accepted
time: 103ms
memory: 22564kb

input:

60 60 3000
32 72
16 110
13 102
52 65
36 79
39 118
16 64
46 108
56 116
10 109
35 117
28 90
31 83
36 78
14 77
6 104
4 64
5 73
34 63
21 66
56 61
26 64
37 106
53 92
2 91
35 102
40 99
57 95
40 79
53 104
20 72
60 118
41 112
60 106
2 101
60 113
50 87
31 102
46 88
44 98
18 101
34 87
52 63
52 86
56 85
8 99
5...

output:

1946
2910 3000 2997 2684 1722 2968 2695 2584 2907 2952 2828 2477 2754 2936 2931 1675 2864 2505 2918 2752 1415 2810 2732 2421 2403 2668 2586 2165 2939 2879 2736 2888 2994 1874 2744 2310 2800 2920 2890 2345 2780 2877 2882 1846 2960 2604 2935 2710 2852 2957 2737 2829 2716 2365 2914 2930 2179 2865 2574 ...

result:

ok accepted

Test #18:

score: 0
Accepted
time: 114ms
memory: 28484kb

input:

60 60 3000
13 110
32 77
31 63
23 75
28 119
16 84
32 113
50 114
15 66
47 96
21 97
41 81
55 88
25 110
59 112
1 100
45 115
27 66
24 66
38 94
40 67
39 95
6 109
30 75
3 117
43 111
28 118
37 101
57 66
58 90
57 79
47 69
13 87
6 115
57 101
54 88
14 78
22 68
53 78
58 73
10 74
40 94
43 107
34 93
19 85
44 86
5...

output:

2770
2999 2953 2845 2644 2952 2781 2860 2958 2787 2918 2742 2485 2602 2964 2871 2525 2506 2811 2898 2883 2823 2733 2568 2904 2986 2934 2886 2865 2691 2849 2447 2966 2838 2933 2928 2945 2983 2762 2690 2583 2803 3000 2948 2995 2674 2994 2219 2960 2451 2881 2396 2897 2981 2495 2625 2795 2909 2915 2494 ...

result:

ok accepted

Test #19:

score: 0
Accepted
time: 73ms
memory: 20360kb

input:

80 80 200
32 95
60 86
23 146
79 154
7 81
66 81
56 96
74 100
20 120
54 157
48 148
69 144
60 87
74 87
3 141
60 150
48 125
39 129
37 82
4 81
19 95
30 132
62 136
67 118
77 119
79 129
51 119
51 152
72 114
34 110
27 84
40 112
24 123
32 133
28 131
34 102
75 102
5 93
30 135
39 131
4 160
24 107
49 148
75 149...

output:

106
98 105 133 148 152 169 100 113 1 102 21 156 172 187 37 59 26 36 44 151 93 106 192 56 27 23 69 109 196 114 141 150 80 19 167 155 5 138 47 6 72 61 92 149 123 108 96 38 63 18 171 121 174 53 132 43 9 143 165 134 181 197 131 31 50 195 35 137 7 78 75 158 55 58 159 30 191 128 48 170 82 164 74 124 142 8...

result:

ok accepted

Test #20:

score: 0
Accepted
time: 87ms
memory: 19388kb

input:

80 80 1000
25 148
12 123
32 124
64 137
45 81
30 114
3 135
13 142
50 130
23 113
42 146
64 139
66 148
5 136
62 86
19 137
57 128
1 90
56 103
38 155
43 84
3 88
62 130
12 87
15 107
27 117
6 135
17 132
54 149
53 109
5 121
17 93
6 132
50 133
62 94
20 88
6 143
44 148
33 131
61 118
68 149
57 141
46 159
55 15...

output:

806
939 903 854 675 968 898 801 971 715 647 959 983 831 840 936 980 944 886 922 838 908 899 896 946 660 923 942 901 771 615 598 745 985 761 966 664 891 807 830 857 816 804 871 706 951 859 928 689 867 780 981 843 853 716 582 994 669 870 921 592 833 835 786 876 916 764 902 585 894 494 975 972 883 653 ...

result:

ok accepted

Test #21:

score: 0
Accepted
time: 91ms
memory: 21652kb

input:

80 80 2000
53 123
41 154
25 132
32 137
40 149
78 99
2 105
11 110
30 91
26 129
41 110
75 131
62 98
15 87
6 144
35 103
16 136
69 134
56 146
78 159
2 155
15 140
24 134
34 113
61 88
22 131
73 156
46 116
68 113
48 115
28 92
22 93
53 156
56 149
27 104
56 91
25 140
52 87
50 129
48 91
58 127
15 125
12 111
1...

output:

1496
1101 1334 1504 1895 1167 1943 1670 1671 1915 1636 1775 1349 1932 1912 1129 1848 1298 1367 1823 1529 1934 1388 1970 1998 1844 1935 1766 1763 1973 981 1923 1596 1632 1750 1446 1950 1993 1834 1975 1482 890 1698 1396 1422 1433 1869 1683 1918 1812 1842 1984 1870 1717 1855 1694 1474 1647 1810 1635 18...

result:

ok accepted

Test #22:

score: 0
Accepted
time: 96ms
memory: 23836kb

input:

80 80 2000
7 97
42 84
29 152
46 115
34 111
50 121
34 153
62 150
63 138
14 154
27 134
34 116
20 90
37 143
66 149
62 102
10 160
43 110
37 152
29 112
5 99
68 139
55 122
74 135
43 113
71 159
5 131
37 106
70 118
3 124
2 87
35 130
74 99
70 134
44 143
55 134
26 81
10 133
47 130
24 92
77 108
13 133
56 87
39...

output:

1404
1898 1975 1865 1911 1777 1933 1656 1843 1944 1643 1917 1848 1622 1382 1794 1577 1804 1936 1730 1937 1841 1084 1895 822 1393 989 1551 1896 1995 1919 1860 1878 1994 1832 1992 1813 1908 1882 1929 1215 1958 1889 1990 1959 1446 1586 1972 1945 1838 1811 1998 1557 1783 1839 1899 1722 1791 1030 1591 12...

result:

ok accepted

Test #23:

score: 0
Accepted
time: 102ms
memory: 21588kb

input:

80 80 2000
75 99
6 84
42 111
54 127
12 116
42 113
18 114
22 131
70 139
29 83
5 98
50 83
77 104
20 132
24 100
55 132
54 151
52 110
61 128
44 127
74 105
58 160
61 104
42 93
80 160
54 98
48 103
11 87
38 152
29 103
18 135
72 160
77 154
1 116
6 134
2 112
37 134
13 154
51 157
75 114
77 131
9 139
12 106
34...

output:

1638
1851 1905 1344 840 1949 1345 1908 1956 1590 1976 930 1031 1568 1767 1988 1598 1541 1411 1704 1947 1656 1518 1687 1992 1579 1982 1751 1717 1917 1985 1666 1969 1964 1987 1769 1941 1424 1438 1648 1945 1734 1417 1981 1896 1872 1830 1736 1812 1730 1559 1909 1321 1571 1752 1297 1936 1863 1800 1828 16...

result:

ok accepted

Test #24:

score: 0
Accepted
time: 126ms
memory: 22504kb

input:

80 80 3000
11 116
24 95
4 152
51 137
12 102
44 128
69 120
69 134
39 122
17 94
51 102
61 144
52 84
57 81
32 117
55 125
9 136
13 127
31 120
26 87
58 141
73 157
28 153
26 106
63 82
63 151
45 107
16 115
38 87
5 115
14 151
2 156
79 152
33 104
26 107
33 123
2 152
79 83
23 131
67 154
34 159
29 110
20 152
1...

output:

2518
2948 2964 2385 2933 2777 2434 2975 2931 2726 2812 2838 2707 2950 2968 2888 1906 2697 2918 2074 2919 2749 2934 2851 2861 2897 2860 2474 2849 2584 2947 2916 2141 2986 2527 2608 2689 2906 2151 2900 2550 2941 2790 2905 2822 2891 2814 2713 2641 2715 2678 2946 2782 1604 2451 2684 2324 2978 2992 2999 ...

result:

ok accepted

Test #25:

score: 0
Accepted
time: 120ms
memory: 24628kb

input:

80 80 3000
53 81
62 95
69 96
5 110
41 101
18 123
55 110
51 148
36 117
55 108
72 130
9 152
26 147
38 100
30 155
19 155
50 91
15 100
74 110
33 146
41 154
46 113
37 91
43 133
56 137
66 131
39 114
10 107
11 99
47 133
64 91
30 120
13 156
17 94
7 82
50 85
45 108
24 115
73 90
18 107
34 97
27 147
58 91
78 1...

output:

2715
2957 2846 2597 2734 2497 2373 2944 2758 2963 2890 2598 2982 2926 2712 2702 2661 2915 2986 2893 2985 2980 2920 2896 2898 2318 2826 2907 2932 2777 2904 2865 2743 2801 2629 2973 2937 2960 3000 2627 2876 2820 2818 2641 2991 2717 2604 2978 2706 2522 2767 2859 2674 2180 2808 2934 2948 2769 2301 2596 ...

result:

ok accepted

Test #26:

score: 0
Accepted
time: 114ms
memory: 26464kb

input:

80 80 3000
74 117
47 82
50 131
13 156
58 101
29 157
56 151
75 87
11 135
78 82
71 151
16 157
68 102
26 159
45 130
70 122
68 123
11 91
42 142
59 125
52 141
9 105
33 110
74 140
21 83
29 130
20 104
61 156
1 94
9 102
40 97
57 90
44 104
67 120
12 144
36 116
55 114
77 155
60 110
60 93
36 151
37 137
22 155
...

output:

2355
2760 2944 2995 2608 2797 2906 2938 2965 2302 2981 2908 2837 2972 2967 2801 2999 2945 2975 2737 2569 2849 2229 2524 2727 2962 2882 2910 2636 2876 2502 2497 2774 2490 2924 2979 2919 2711 2024 2386 2078 2729 2385 2909 2951 2661 2966 1997 2770 2149 2976 2942 1603 2996 2911 2890 2823 2844 2723 2875 ...

result:

ok accepted

Test #27:

score: 0
Accepted
time: 114ms
memory: 24796kb

input:

80 80 3000
29 138
41 120
64 108
62 95
71 147
45 110
37 154
71 82
49 84
55 82
18 81
1 141
41 139
78 130
3 135
65 134
48 102
25 81
17 121
21 83
10 125
49 104
63 144
14 111
64 130
23 87
13 97
72 100
36 97
37 100
46 110
59 82
7 86
73 157
77 98
75 122
15 108
27 106
18 149
54 133
48 106
63 86
58 150
13 13...

output:

2524
2629 2940 2506 2707 2386 2911 2633 2752 2657 2411 2755 2944 2921 2988 2849 2600 2881 2832 2984 2977 2887 2981 2734 2997 2967 2959 2898 2852 2419 2761 2970 2801 2550 2679 2653 2900 2201 2971 2886 2266 2966 2666 2785 2587 2880 2193 2960 2949 2950 2695 2245 2961 2799 2979 2824 2952 2983 2789 2794 ...

result:

ok accepted

Test #28:

score: 0
Accepted
time: 107ms
memory: 22704kb

input:

80 80 3000
77 151
47 107
20 102
48 160
69 104
16 155
52 154
64 118
70 132
30 141
66 132
36 100
66 109
12 147
33 145
48 142
72 149
44 154
29 117
60 127
63 118
21 115
61 150
50 131
12 148
39 108
8 155
62 153
6 87
80 130
27 153
33 128
18 150
80 121
62 95
8 96
39 151
26 123
23 120
35 124
31 113
54 100
1...

output:

1998
2845 2721 2967 2766 2792 2483 2867 2972 2962 2463 2855 2803 2716 2597 2560 2717 2676 1874 2944 1713 2006 2965 2919 2011 2596 2682 2884 2969 2771 2922 2711 2271 2532 2942 2898 2936 2951 2841 2903 2581 2419 2874 2983 2555 2784 2475 2988 2856 2921 1746 2738 2935 2454 2876 2785 2259 2813 2930 2298 ...

result:

ok accepted

Test #29:

score: 0
Accepted
time: 225ms
memory: 22680kb

input:

1000 1000 3000
42 1981
990 1593
249 1397
568 1481
729 1994
719 1296
178 1959
177 1008
585 1063
612 1102
888 1378
888 1789
883 1380
978 1981
113 1754
253 1953
902 1262
518 1588
806 1449
489 1271
368 1026
317 1123
2 1988
962 1227
336 1880
927 1703
414 1043
402 1032
766 1538
226 1736
799 1879
813 1143
...

output:

1578
2711 2923 1415 1222 677 528 2686 424 2468 688 2594 2742 671 614 2618 1174 2356 204 1635 478 221 1909 1698 5 1699 2632 1074 1963 1316 2254 2162 2723 2271 371 629 323 2906 1871 2370 2919 653 2308 916 152 899 392 1054 1633 849 2672 2978 2637 432 442 1989 1531 1038 316 701 1345 2851 2835 3000 812 1...

result:

ok accepted

Test #30:

score: 0
Accepted
time: 219ms
memory: 22548kb

input:

1000 1000 3000
912 1168
247 1188
798 1560
618 1138
611 1467
268 1411
302 1117
885 1023
934 1777
732 1717
827 1421
855 1063
928 1047
135 1603
59 1730
307 1539
681 1044
413 1011
44 1689
328 1891
101 1678
334 1171
931 1500
577 1793
556 1714
346 1748
628 1949
417 1736
59 1356
401 1783
67 1571
924 1064
1...

output:

1594
1223 551 2949 2647 249 1488 2560 1018 2782 1618 1155 2553 1382 1613 2663 1840 2301 1021 777 2207 1318 1177 368 1587 2801 1723 2590 1475 2772 849 1446 1657 1156 555 1834 2319 94 725 2978 2935 2181 2729 1314 685 1006 188 2761 856 215 2876 1862 2280 1605 1597 61 295 1360 767 1665 1803 342 577 1100...

result:

ok accepted

Test #31:

score: 0
Accepted
time: 222ms
memory: 22380kb

input:

1000 1000 3000
330 1699
664 1166
556 1642
273 1288
354 1795
435 1525
157 1163
200 1501
922 1144
264 1052
823 1819
998 1773
822 1869
268 1204
415 1681
355 1775
260 1214
567 1086
204 1099
509 1738
330 1147
382 1138
924 1961
221 1213
834 1739
895 1196
864 1342
174 1933
153 1175
343 1461
232 1836
811 11...

output:

1655
2138 2052 1902 1964 2796 486 1812 2690 2863 2708 96 55 1660 2481 1512 506 2012 2900 537 2805 2663 1554 1864 2949 2937 2911 1441 2724 2893 1885 1759 831 741 2639 1914 339 1685 2081 2374 1859 1994 2759 2359 2102 1978 822 882 1849 814 389 611 137 2370 2692 1342 1044 2180 2369 2959 1047 2909 911 16...

result:

ok accepted

Test #32:

score: 0
Accepted
time: 265ms
memory: 28472kb

input:

1500 1500 3000
1341 1517
832 1618
1031 1651
1128 1677
206 1889
347 2836
225 2772
1198 1733
1307 1884
84 1870
425 2658
162 2097
467 2062
1406 2565
1143 1980
1335 2339
822 2100
310 1792
291 2224
1276 2244
1382 1532
50 1510
1010 2756
427 2992
1387 2727
812 1916
1007 2328
1480 2107
1337 2117
634 2621
60...

output:

1404
2431 2174 2248 390 1044 1685 980 2752 632 2048 656 216 1935 1451 2284 1790 1785 15 1236 406 2910 2143 1958 1471 2725 100 674 1926 2280 2445 1959 1155 1271 2944 1392 2824 2426 1583 1495 1947 1351 2039 2698 2930 22 2564 204 718 2113 84 1800 1534 377 2006 2787 195 2321 2544 2154 1248 123 1971 89 2...

result:

ok accepted

Test #33:

score: 0
Accepted
time: 265ms
memory: 24484kb

input:

1500 1500 3000
963 1846
402 2056
303 1852
588 2296
151 2990
226 2196
648 2054
1379 2292
1380 2920
476 2550
515 2519
573 1666
606 2770
180 2089
966 1885
565 2598
1041 1749
227 2525
1250 2576
135 2488
882 1767
63 2446
1054 2867
346 2742
601 1811
156 2279
828 2261
164 2318
1215 1806
989 1547
688 2798
1...

output:

1424
2009 1694 2852 1478 2764 667 2959 2166 1251 1071 1505 1216 1993 303 2327 1594 274 1775 2667 1831 595 2298 1417 2102 555 1527 2498 2600 2582 717 1140 1541 724 2566 44 1712 2268 2411 1088 2406 545 1367 1967 365 566 1077 1100 121 411 529 815 4 2074 2098 959 2828 1702 2446 1475 14 1959 2300 705 277...

result:

ok accepted

Test #34:

score: 0
Accepted
time: 276ms
memory: 28656kb

input:

1500 1500 3000
1096 1885
448 2108
894 1764
709 1632
61 2276
1076 2084
1027 1782
1486 1725
616 1836
799 1947
1022 2781
1316 2373
642 1660
1430 2784
68 2181
1224 2665
1450 2212
563 2852
81 1596
462 2169
770 2219
1197 2031
657 2366
616 2170
1091 1783
1130 1968
312 1958
671 2599
465 2683
1144 1773
1344 ...

output:

1449
904 1630 2841 519 1352 1602 473 192 2232 688 1451 1339 266 2866 1579 2422 2114 544 2358 2999 1920 1457 2297 731 1110 2497 1250 953 1122 2600 275 2549 896 938 1490 2501 701 1049 1007 1310 1558 2528 2337 2581 1945 2850 1883 2438 1388 2217 2047 1691 1278 1109 1504 2448 2697 2037 947 700 1297 971 2...

result:

ok accepted

Test #35:

score: 0
Accepted
time: 390ms
memory: 24448kb

input:

3000 3000 3000
2456 3024
1202 5160
2592 4208
2830 4943
1279 5401
1554 5363
1051 3868
2353 4169
715 3495
2991 3962
903 3817
499 3427
1514 3738
805 3993
1681 4194
1999 3705
2935 5180
14 5270
420 3900
1857 5035
2587 3131
357 5790
2123 5059
2085 3573
2656 4794
1319 5107
971 5854
2212 4142
1452 3062
2907...

output:

1312
264 2620 92 1129 246 1299 1041 1489 313 1687 535 2008 743 1169 113 1796 307 1950 1655 2130 314 2153 1454 864 2073 918 1861 934 2421 2060 60 620 432 1867 1538 2255 765 420 1246 573 303 471 1255 2938 1722 1952 1455 1181 2567 278 1070 2765 405 1548 1658 2643 1152 200 2945 649 2535 1020 1583 1470 2...

result:

ok accepted

Test #36:

score: 0
Accepted
time: 389ms
memory: 24708kb

input:

3000 3000 3000
1225 3659
1285 5562
456 4991
234 5043
2878 5234
574 3408
283 5144
2343 4635
620 3335
868 5368
583 4477
168 5058
2245 3361
292 5035
2635 5228
745 5426
1136 4128
1383 3242
387 3091
792 5561
859 4534
97 3979
309 3385
2706 5354
2476 4940
2664 3304
1874 4625
197 5659
2253 3502
2034 5653
17...

output:

1328
823 476 951 775 323 2530 2324 1780 2445 2204 555 1472 482 2872 851 302 2583 1922 2456 1808 2011 144 2432 1086 219 2503 1429 968 2272 2928 821 2062 1484 1449 22 1848 1432 928 2126 196 2203 1110 2654 2826 1042 1939 671 2841 2552 1653 2047 899 782 520 1870 1576 429 371 764 1168 12 2918 2174 2957 4...

result:

ok accepted

Test #37:

score: 0
Accepted
time: 389ms
memory: 28500kb

input:

3000 3000 3000
271 3216
919 3270
2084 3946
1699 3741
1761 5849
2381 3271
18 4257
858 3256
1250 4068
1291 3452
701 5072
2433 5871
173 4675
667 3842
25 4434
1289 4855
803 4656
19 4119
2904 5305
840 4229
1623 4731
448 3748
2983 5773
173 5976
736 4127
2544 4618
1853 4626
10 5952
1633 5075
234 4686
2646 ...

output:

1334
2463 2228 967 2747 1737 2134 1216 1963 1725 841 7 15 182 2356 2882 1789 553 1346 1924 2199 1949 765 1074 1489 653 338 908 399 1546 2299 222 1131 480 2843 152 2017 962 900 2571 472 581 482 2577 1500 1617 58 266 1053 514 525 1984 1741 2542 1215 2337 146 2421 595 1802 2872 2264 829 2586 973 1100 3...

result:

ok accepted

Test #38:

score: 0
Accepted
time: 385ms
memory: 28676kb

input:

3000 3000 3000
1240 5393
448 3778
1526 5830
1069 4379
2113 5862
2197 3795
2060 5414
1389 5745
2001 4663
2058 3176
2620 4112
2317 5026
2291 5281
1835 5049
229 4896
1359 3573
78 3136
164 5183
515 4637
1256 4807
1810 3313
952 4561
1967 4231
2056 5900
2316 5234
2860 5322
1347 3002
371 5623
2341 4439
69 ...

output:

1264
2703 631 2728 268 133 266 995 2080 2484 303 1359 2933 409 447 537 1033 1693 773 145 1519 2595 585 1266 120 2034 1007 1144 855 2542 1670 30 2731 371 1110 2056 1019 540 910 2889 853 2009 905 1543 2345 2837 115 1567 805 1760 2527 2721 2985 829 1521 2307 2654 2263 700 1527 1260 1125 2137 2823 1610 ...

result:

ok accepted

Test #39:

score: 0
Accepted
time: 382ms
memory: 20752kb

input:

3000 3000 3000
2732 3825
1144 3457
2386 4614
324 3425
2126 4021
2074 3415
2793 3761
233 5169
2564 3807
1810 3200
1068 3668
1932 4718
2280 5699
2834 3937
2436 3949
1827 4285
252 3913
1492 3209
1103 4839
2432 3368
255 4553
473 4799
104 5606
1554 4561
425 4997
2573 4572
696 5263
71 3872
2980 5845
222 3...

output:

1284
2325 101 1678 1600 49 2009 2097 1500 1202 1402 304 2174 1160 1707 2054 2545 1347 2842 1175 46 2115 165 317 2541 1429 1674 1327 702 511 2177 130 2441 2592 2463 1221 1677 1993 2751 1092 525 2420 1177 1773 2312 2719 1747 2675 1815 131 1196 643 2339 1238 45 204 1353 1306 2135 1631 663 438 1756 215 ...

result:

ok accepted

Test #40:

score: 0
Accepted
time: 127ms
memory: 22632kb

input:

80 80 3000
60 158
24 126
41 116
41 130
65 113
22 85
62 93
25 94
4 102
42 144
48 104
37 83
31 134
30 127
26 82
4 153
32 146
72 141
76 106
27 108
21 154
10 126
57 133
59 83
18 104
61 133
20 125
24 108
31 127
51 132
58 152
37 94
41 105
59 126
5 135
59 156
1 156
28 84
2 152
65 137
5 81
7 118
7 121
56 14...

output:

2595
2893 2949 2998 2840 2311 2669 2679 2898 2694 2804 1996 2966 2299 2963 1943 2658 2664 2977 2676 2055 2568 2884 2882 2976 2729 2315 2895 2326 2897 1783 2851 2514 2914 2779 2961 2960 2766 2971 2849 2014 2984 2999 2559 2983 2945 2906 2833 2793 2744 2950 2736 2980 2985 2880 2940 2698 2991 2098 2987 ...

result:

ok accepted

Test #41:

score: 0
Accepted
time: 120ms
memory: 26592kb

input:

80 80 3000
76 153
16 113
46 144
40 122
19 160
6 113
7 89
78 137
35 147
60 135
70 98
60 150
50 96
59 151
73 116
37 133
31 95
34 154
50 107
40 141
79 159
38 82
70 86
2 140
6 147
71 124
4 136
71 120
72 151
33 155
21 83
62 130
19 118
55 160
40 149
79 132
40 130
80 87
33 157
58 95
4 102
61 115
65 124
63 ...

output:

2690
2683 2942 1855 2988 2853 2785 2781 2850 2946 2937 2948 2547 2768 2738 2836 2962 2981 2881 2735 2801 2844 2496 2951 2839 2897 2328 2585 2911 2878 2820 2803 2847 2957 2291 2690 2916 2275 2939 2701 2576 2666 2724 2993 2944 2977 2763 2863 2821 2862 2205 2582 2717 2463 2578 2816 2742 2969 2958 2859 ...

result:

ok accepted

Test #42:

score: 0
Accepted
time: 121ms
memory: 22408kb

input:

80 80 3000
18 90
65 104
65 136
43 145
37 119
79 102
62 136
15 149
28 102
47 109
40 83
49 145
9 86
22 156
57 145
56 135
19 121
38 133
67 150
14 153
4 116
23 149
31 155
72 82
5 90
35 93
1 114
1 113
9 98
77 93
66 155
13 114
10 134
30 137
63 131
74 119
20 136
32 96
67 143
24 125
36 137
29 92
30 94
19 13...

output:

2404
2713 2760 2860 2978 2983 2730 2837 2887 2274 2878 2947 2999 2583 2933 2968 2890 2961 2748 2926 2979 2317 2951 2937 2790 2988 2976 2789 2641 2882 2784 2164 2460 2876 2960 2820 2916 2955 2823 2867 2584 1838 2665 2646 2767 2934 2893 2844 2561 2962 2909 2828 2602 2269 2899 2565 2924 2990 2777 2493 ...

result:

ok accepted

Test #43:

score: 0
Accepted
time: 128ms
memory: 26596kb

input:

100 100 3000
61 192
7 198
67 187
100 171
74 109
84 124
100 117
42 186
45 122
2 186
57 181
49 117
48 179
11 142
21 163
52 189
85 170
39 195
73 198
28 192
12 168
97 170
5 127
41 149
89 124
74 144
91 105
52 173
19 139
12 160
12 149
34 198
29 145
30 157
89 180
33 165
23 105
21 181
82 184
49 122
10 189
8...

output:

2812
2906 1672 2844 2813 2903 2836 2653 2737 2927 2923 2948 2936 2818 2825 2848 2245 2888 2710 2828 2718 2567 2220 2668 2883 2981 2139 2908 2667 2025 2882 2999 2817 2678 2975 2932 2956 2950 2849 2679 2947 2803 2754 2692 2917 2787 2984 2993 2994 2690 2934 2945 2918 2920 2878 2961 2756 2007 2831 2978 ...

result:

ok accepted

Test #44:

score: 0
Accepted
time: 116ms
memory: 22508kb

input:

100 100 3000
78 108
74 150
3 158
55 121
1 106
3 138
97 140
53 176
51 105
55 140
73 169
93 145
10 174
61 127
59 194
57 143
12 179
25 129
27 137
24 178
21 188
66 151
74 184
64 154
83 117
22 125
52 164
1 175
51 142
54 177
89 127
62 173
63 145
81 102
21 147
96 111
26 166
80 101
69 183
15 152
53 130
1 13...

output:

2553
2310 2866 2468 2807 2742 2573 2845 2826 2929 2745 2899 2387 2740 2230 2760 2614 2887 2876 2917 2940 2904 2654 2836 2990 2197 2641 2814 2963 2926 2703 2472 2909 2806 2178 2870 2996 2972 2219 2471 2692 2791 2883 2331 2138 2304 2405 2053 2539 2821 2987 2688 2864 1873 2933 2261 2962 2754 2786 2597 ...

result:

ok accepted

Test #45:

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

input:

100 100 3000
48 150
49 127
42 138
24 150
67 141
87 126
45 118
20 145
98 118
52 176
8 150
19 131
40 142
13 108
17 140
9 174
24 170
5 193
53 172
15 122
10 110
86 195
56 174
35 164
46 199
68 155
84 188
53 163
88 122
82 139
83 102
5 197
78 153
57 191
61 187
50 142
30 156
97 156
42 107
24 189
96 122
1 14...

output:

2451
2625 2810 2764 2837 2945 2857 2912 2562 2687 2971 2960 2635 1713 2713 2271 2842 2586 2499 2981 2436 2695 2911 2998 2921 2759 2721 2445 2886 2995 2696 1710 2887 2899 2983 2601 2867 2386 2243 2861 2980 2813 2745 2627 2831 2984 2358 2675 2600 2583 2954 2979 2498 1936 2624 2560 2914 2685 2923 2251 ...

result:

ok accepted

Test #46:

score: 0
Accepted
time: 135ms
memory: 22520kb

input:

500 500 3000
90 523
474 549
108 835
20 597
167 707
274 585
345 665
456 601
114 757
195 727
126 843
300 941
346 814
298 699
36 510
169 801
129 664
135 840
192 734
412 958
247 531
66 892
261 920
230 789
108 584
170 965
351 764
191 643
150 894
173 979
97 884
1 707
108 772
282 817
263 782
365 537
444 52...

output:

2990
2971 2779 1765 2281 996 2933 2835 1620 2176 2677 2862 2701 965 2953 1268 1586 1593 2043 2994 2154 911 2977 2125 2905 2849 1888 2978 2726 2474 2663 650 2625 2659 2013 1402 1354 2859 396 2209 2939 2564 2162 2070 2624 2896 2907 1350 2902 2016 2609 1864 2531 2492 2108 2851 1618 2864 2495 2250 2803 ...

result:

ok accepted

Test #47:

score: 0
Accepted
time: 145ms
memory: 24564kb

input:

500 500 3000
457 981
496 955
394 548
362 673
103 659
303 981
39 523
173 664
346 540
396 735
351 847
185 681
440 752
131 586
447 608
98 853
280 515
198 579
162 575
308 640
449 533
471 705
128 655
355 546
495 982
158 657
410 657
38 833
116 784
212 718
184 688
22 685
42 916
410 738
465 554
312 712
456 ...

output:

2796
2531 2595 2325 2808 2819 2186 2786 2965 1276 2331 2672 2962 2358 2688 2867 2145 2541 2589 2321 1476 2897 1957 2846 2771 2441 2964 2915 2719 1190 1883 1820 1643 2959 2553 2873 2598 2752 2728 2088 1467 2704 1877 2842 1996 2656 2330 2388 1493 2221 2254 2948 1844 2409 2546 2416 2565 2567 1917 2995 ...

result:

ok accepted

Test #48:

score: 0
Accepted
time: 148ms
memory: 22600kb

input:

500 500 3000
120 735
270 735
156 857
284 776
215 764
102 826
206 929
460 861
486 839
166 693
452 811
298 768
276 928
315 978
196 828
132 746
436 786
222 775
21 619
88 611
320 960
194 874
498 975
410 706
409 924
327 979
275 644
257 925
202 611
280 849
394 816
220 505
224 645
322 799
95 695
313 621
21...

output:

2267
1102 2794 2397 2742 1838 628 1887 1541 37 2718 809 1609 844 2915 1010 2755 2335 2738 2284 2745 2359 2640 2568 1920 2432 2473 2287 2676 1560 2141 2882 1062 2813 2468 2447 2361 2388 1358 2808 2902 1748 2026 2989 2832 1734 2710 2071 2642 2636 2393 2414 2974 975 2563 2815 1284 937 1935 1912 267 122...

result:

ok accepted

Test #49:

score: 0
Accepted
time: 119ms
memory: 24324kb

input:

80 80 2999
78 101
75 105
33 137
9 104
76 122
42 116
6 135
51 155
62 95
9 107
34 125
68 160
34 111
56 132
65 102
71 133
67 101
37 130
60 133
8 113
60 113
61 121
77 101
42 157
1 94
74 115
53 100
65 113
29 147
42 122
43 85
28 139
54 125
42 148
21 154
62 115
69 91
54 148
64 144
8 125
38 142
51 93
39 104...

output:

2999
2984 2940 2838 2830 2901 2542 2829 2366 2809 2858 2887 2926 2367 2835 2716 2512 2955 2806 2904 2986 2965 2774 2980 2891 2905 2945 2041 2674 2788 2602 2596 2914 2823 2998 2683 2537 2921 2770 2987 2885 2889 2876 2825 2593 2996 2446 2958 2817 2759 2641 2991 2449 2890 2896 2979 2937 2796 2909 2971 ...

result:

ok accepted

Test #50:

score: 0
Accepted
time: 119ms
memory: 24472kb

input:

80 80 2997
79 159
53 129
68 88
34 99
6 90
62 143
13 135
76 121
80 127
30 151
12 141
6 88
42 107
23 122
39 152
80 128
5 91
36 104
9 89
67 131
63 88
25 158
35 118
61 123
44 113
73 116
22 150
10 87
71 81
29 119
25 104
3 110
63 152
5 139
61 97
57 112
17 95
70 99
32 89
23 124
3 153
17 155
51 159
27 101
7...

output:

2993
2943 2895 2871 2980 2648 2937 2692 2605 2995 2983 2952 2968 2888 2779 2842 2953 2480 2909 2903 2864 2902 2957 2593 2877 2208 2951 2975 2989 2914 2916 2838 2966 2491 2976 2973 2814 2960 2944 2655 2861 2985 2800 2557 2934 2701 2993 2941 2618 2447 2428 2743 2719 2860 2820 2964 2702 2994 2982 2837 ...

result:

ok accepted

Test #51:

score: 0
Accepted
time: 120ms
memory: 22464kb

input:

80 80 2997
57 81
6 112
14 102
29 159
15 103
53 109
6 87
11 145
45 148
43 85
57 82
68 116
29 129
41 86
57 126
42 100
68 136
74 154
38 141
26 144
37 107
5 81
24 95
61 131
48 149
27 88
75 99
4 134
15 104
29 146
13 102
16 128
70 101
52 100
26 154
72 127
17 113
45 102
32 158
28 83
42 159
22 121
58 158
2 ...

output:

2920
2992 2134 2947 2970 2808 2940 2862 2996 2888 2960 2856 2995 2802 2795 2932 2736 2929 2829 2906 2878 2854 2687 2989 2965 2938 2788 2676 2370 2991 2963 2891 2916 2933 2901 2441 2632 2935 2509 2977 2890 2894 2762 2924 2982 2040 2876 2643 2772 2896 2936 2674 2974 2839 2863 2985 2884 2835 2603 2747 ...

result:

ok accepted

Test #52:

score: 0
Accepted
time: 112ms
memory: 28640kb

input:

80 80 2999
34 150
76 97
22 138
13 130
65 152
39 145
69 103
20 108
10 100
66 95
60 93
17 126
6 110
2 113
79 158
77 155
65 119
50 108
1 123
22 130
11 83
51 125
58 124
72 118
3 105
59 90
24 122
63 99
36 97
73 104
9 121
13 124
35 99
60 134
24 104
55 96
29 100
10 102
20 129
70 133
63 89
16 150
17 111
37 ...

output:

2044
2810 2971 2927 2855 2827 2762 2161 2967 2846 2972 2987 2975 2852 2804 2781 2847 2913 2940 2891 2646 2842 2162 2920 2969 1688 1433 2654 2939 2944 2779 2813 2795 2773 2764 2966 2990 2893 2958 2997 2834 2701 2955 2838 2881 2330 2960 2832 2956 2869 2950 2962 2878 2454 2819 2857 2718 1973 2461 2824 ...

result:

ok accepted

Test #53:

score: 0
Accepted
time: 82ms
memory: 24680kb

input:

80 80 3000
26 107
48 88
12 145
29 150
77 156
12 137
36 143
11 120
71 129
51 134
48 96
12 116
5 135
31 151
12 85
80 147
54 119
73 87
38 159
10 83
2 154
4 139
51 114
66 118
73 97
64 146
27 104
36 100
53 85
80 157
8 150
48 123
42 160
61 81
42 108
46 122
74 94
52 116
42 96
2 93
63 103
21 87
28 88
57 155...

output:

540
2969 2976 1497 2961 2898 2838 2392 2477 2355 1786 1039 2406 2845 2916 2703 2659 1227 1428 2936 2859 2907 2658 92 2841 2724 2860 2737 2292 2920 2855 2119 2278 830 2730 2935 2725 2963 2934 2599 2895 812 1179 2974 2007 2706 2921 2959 2686 2883 2809 589 2346 1279 1092 104 1678 2573 2874 481 2882 245...

result:

ok accepted

Test #54:

score: 0
Accepted
time: 107ms
memory: 24564kb

input:

100 100 2997
61 183
100 170
23 125
72 200
25 159
87 169
64 120
47 154
54 176
82 185
83 180
53 101
38 166
46 191
10 111
99 105
20 192
97 152
84 133
49 174
67 147
12 137
57 130
16 111
74 102
97 198
65 112
77 122
26 189
46 112
58 112
69 134
94 154
77 117
32 132
72 197
75 105
52 121
57 117
86 172
43 120...

output:

2997
2996 2839 2865 2913 2982 2967 2978 2989 2849 2976 2925 2813 2993 2905 2793 2881 2457 2955 2950 2579 2654 2980 2674 2562 2761 2943 2399 2864 2885 2873 2529 2932 2610 2704 2848 2938 1910 2823 2953 2862 2992 2898 2984 2894 2897 2584 2997 2918 2959 2930 1888 2960 2706 2638 2537 2799 2491 2567 2858 ...

result:

ok accepted

Test #55:

score: 0
Accepted
time: 112ms
memory: 26588kb

input:

100 100 2997
62 187
98 108
18 133
22 178
48 168
39 186
35 143
100 120
29 180
10 124
87 122
7 133
82 169
43 183
61 136
62 159
32 151
59 180
33 195
56 133
73 159
8 118
75 110
99 136
90 107
14 155
83 114
12 160
54 110
68 179
16 192
39 107
70 197
77 178
18 160
69 151
93 122
90 186
13 131
33 197
90 118
3...

output:

2991
2924 2862 1865 2993 2179 2967 2982 2929 2752 2901 2743 2983 2980 2807 2954 2616 2050 2824 2763 2923 2937 2778 2712 2557 2567 2900 2644 2952 2874 2922 2860 2932 2748 2948 2764 2582 2863 2825 2818 2919 2834 2341 2968 2733 2839 2596 2994 2503 2642 2885 2647 2820 2816 2945 2623 2723 2908 2668 2831 ...

result:

ok accepted

Test #56:

score: 0
Accepted
time: 131ms
memory: 24616kb

input:

100 100 3000
66 176
42 155
34 127
33 197
65 166
67 151
46 192
39 180
90 195
7 181
61 188
85 144
96 139
89 135
26 143
56 138
3 108
79 123
42 194
95 179
30 156
97 122
93 167
57 115
32 128
87 166
9 111
68 196
12 139
10 168
84 179
60 105
29 167
41 128
79 117
9 170
13 174
15 164
70 102
85 110
22 133
68 1...

output:

2928
2905 2925 2960 2996 2882 2994 2811 2900 2992 2851 2374 2685 2944 2855 2841 2815 2921 2835 2764 2884 2167 2839 2541 2639 2213 2907 2705 2787 2473 2553 2721 2821 2975 2785 2948 2868 2729 2786 2978 2949 2590 2805 2854 2779 2981 2781 2887 2914 2989 2676 2843 2735 2615 2888 2739 2348 2633 2999 2890 ...

result:

ok accepted

Test #57:

score: 0
Accepted
time: 111ms
memory: 22576kb

input:

100 100 2998
23 172
38 135
93 167
88 192
49 162
26 130
5 154
30 165
93 108
31 194
93 166
94 181
20 117
20 132
62 117
47 116
99 175
66 166
45 110
87 109
42 117
34 170
32 120
47 176
78 104
77 188
77 198
68 192
65 153
95 126
39 147
2 158
94 178
77 187
87 102
8 172
58 144
16 174
33 134
95 166
5 147
33 1...

output:

2056
2620 2895 2727 2832 2404 2901 2428 2812 2706 2575 2933 2871 2517 2998 2321 2828 2646 2544 2967 2510 2860 2847 2868 2810 2949 2520 2729 1780 2937 2733 2989 2684 2896 2296 2965 2776 2726 2906 1866 2605 2925 2511 2479 2897 2992 2049 2948 2829 2499 2450 2362 2369 2979 2806 2929 2191 2978 2800 2547 ...

result:

ok accepted

Test #58:

score: 0
Accepted
time: 85ms
memory: 22432kb

input:

100 100 2998
45 150
68 167
44 198
72 191
22 144
81 180
36 183
8 163
22 113
8 103
33 137
30 102
18 119
71 181
66 107
5 189
46 137
65 112
38 181
51 128
26 200
84 160
64 159
39 175
7 193
10 160
92 130
67 147
76 158
83 102
50 122
9 179
67 142
28 133
3 158
96 124
73 193
48 127
47 141
73 177
86 102
51 166...

output:

556
2804 1847 2508 90 2591 2967 2884 2594 2686 2469 2887 2864 2931 2796 2936 2769 1861 2004 2030 1689 2797 2022 1827 2879 2058 2881 1821 2086 1475 2894 1918 2453 2951 2889 2871 2056 151 2478 2920 2003 2303 2836 2670 2654 2722 2937 2984 1752 2888 2950 2350 1112 1032 1746 2760 2155 2806 961 2092 2863 ...

result:

ok accepted

Test #59:

score: 0
Accepted
time: 131ms
memory: 24408kb

input:

500 500 2997
356 564
272 947
375 776
304 842
115 598
357 781
285 796
285 785
123 532
212 920
281 778
304 830
414 659
452 986
240 801
140 683
338 510
37 589
83 548
299 568
328 630
158 515
67 777
42 719
26 851
423 999
123 537
398 770
13 614
224 835
93 553
146 936
430 946
19 516
356 855
395 559
8 591
6...

output:

2997
2587 2806 2882 2349 2133 2979 2662 1982 2976 2207 2551 2724 2322 746 2870 710 2897 2697 2728 2888 2953 2819 2651 1532 1827 2968 1942 2612 1120 2994 2915 2535 2710 2974 2788 2624 541 1426 2893 242 2674 1782 2944 660 2844 2302 2411 2659 2467 805 2946 2282 1874 1836 1496 2955 2301 2189 206 2614 26...

result:

ok accepted

Test #60:

score: 0
Accepted
time: 144ms
memory: 28428kb

input:

500 500 3000
455 904
178 787
97 956
452 524
346 997
441 899
458 597
344 662
236 813
453 549
20 843
239 938
249 999
181 506
172 656
389 515
13 773
288 790
338 988
26 525
94 793
344 862
215 704
79 854
167 780
368 577
95 843
364 541
76 637
34 897
137 681
35 518
398 843
354 784
284 644
315 955
328 929
4...

output:

2994
1796 2857 2143 1951 2015 2803 2550 2307 2445 2282 2778 2806 2483 2822 2990 2976 2205 799 2840 2488 2962 815 2581 1503 2640 2286 2756 2993 2649 1531 994 2043 2824 2685 2983 1907 2618 1183 2504 2487 1772 2593 1783 2913 2384 2083 2851 2002 2358 2884 2597 166 2387 1901 2325 1928 2170 1057 2701 2758...

result:

ok accepted

Test #61:

score: 0
Accepted
time: 142ms
memory: 24444kb

input:

500 500 2997
357 711
34 989
9 762
404 790
260 683
277 902
289 890
73 605
285 690
500 910
158 768
246 587
153 953
153 585
345 724
433 880
186 631
493 633
228 955
400 540
374 717
422 802
219 999
66 920
83 843
175 674
225 789
356 977
166 537
236 685
15 632
52 716
141 718
10 683
289 559
278 829
477 883
...

output:

2921
1676 2600 2913 2616 1690 1866 2748 2826 2665 1937 2842 956 1502 1675 2967 2993 2457 2962 1474 2566 2756 1668 2950 2804 2781 2105 1264 2722 2441 2328 481 2891 2148 2149 1863 2429 2420 1703 1738 2497 1814 2859 2451 2191 2934 2134 2246 895 2663 2843 2752 1934 2760 1009 2652 2871 2850 806 2710 2966...

result:

ok accepted

Test #62:

score: 0
Accepted
time: 155ms
memory: 24704kb

input:

500 500 3000
293 734
37 611
29 515
281 564
414 723
31 796
403 556
284 687
205 592
350 526
349 699
128 911
348 869
292 813
160 596
59 631
388 990
184 621
351 752
90 555
317 758
409 686
304 821
266 977
253 522
400 857
256 646
447 884
230 926
102 760
167 577
375 619
101 675
40 650
149 806
189 743
314 6...

output:

2145
1898 2963 2887 2649 2653 1791 2748 1046 2530 1926 2924 2167 2866 2851 2110 2970 537 2396 2413 635 2605 792 1693 1996 2440 2091 2624 46 2024 2674 130 1544 1280 1195 2089 2108 2769 2358 2771 2700 1946 2501 1474 1663 2356 2080 2443 2557 1994 1217 454 1859 2910 1944 2021 2737 1658 2753 2831 2731 29...

result:

ok accepted

Test #63:

score: 0
Accepted
time: 118ms
memory: 24672kb

input:

500 500 2998
83 866
14 735
68 854
473 743
355 643
89 702
40 859
469 810
233 675
282 797
452 854
109 675
352 990
267 694
155 747
406 868
184 958
287 985
317 960
299 648
189 626
323 712
109 688
309 597
81 805
127 653
468 911
274 697
149 554
473 988
98 939
465 748
384 985
87 734
26 614
89 913
395 542
1...

output:

732
441 2123 1689 2681 989 2282 949 2284 2848 2160 482 1820 2166 515 2828 2979 2454 2060 1609 718 2814 17 396 1037 2692 835 2545 1838 1683 642 2378 928 2203 1026 2172 2570 2366 2756 2231 590 2416 1313 1749 2553 1750 2053 2787 2141 587 1168 85 2292 472 2653 2022 1357 2956 2946 159 593 2838 898 2098 3...

result:

ok accepted

Test #64:

score: 0
Accepted
time: 393ms
memory: 24676kb

input:

3000 3000 2997
2245 4962
1812 5910
519 3608
531 3915
1172 5711
691 3009
738 3318
640 3846
924 5685
1206 4723
1353 4260
2983 5379
1935 5901
904 5905
2652 3675
1567 4509
933 4464
989 5349
1809 3388
1872 5139
1186 5448
1091 3671
1053 4752
1950 5098
2276 5715
1426 3411
1073 3283
2094 3473
2007 5734
2893...

output:

2997
1976 240 2761 1718 2752 279 2690 809 592 2560 927 705 73 1277 119 2993 2086 2702 2875 1150 1155 1165 2676 272 971 2542 1354 1066 1413 2764 853 2520 2419 566 1534 2482 172 554 370 2178 1552 748 743 539 2200 2397 2890 979 2534 1151 2575 90 1964 2231 1968 2243 947 660 1152 2964 2979 2408 1922 651 ...

result:

ok accepted

Test #65:

score: 0
Accepted
time: 365ms
memory: 24564kb

input:

3000 3000 2997
23 4451
64 5869
802 4208
2203 5931
2378 4831
677 3277
2614 3325
8 5690
812 5236
1161 3168
1907 4199
1367 5818
1807 3153
1284 5808
2711 4734
1486 4535
959 5246
1164 4742
2175 5612
1053 4482
502 5487
221 4262
2759 4333
1730 4568
729 3451
230 5851
1311 4593
486 3929
2333 3323
1499 3608
1...

output:

2989
993 1345 2882 2714 2171 1551 2488 2328 2856 1779 1285 1426 62 1159 2495 621 2482 2509 1922 682 2937 1885 2913 220 2169 142 2669 2205 2148 2427 1226 1316 2782 1241 1501 1490 923 2146 979 482 1068 430 225 341 1187 1359 1627 118 2451 1150 882 1873 2077 533 2160 848 2110 74 821 973 1429 1367 665 10...

result:

ok accepted

Test #66:

score: 0
Accepted
time: 400ms
memory: 24556kb

input:

3000 3000 2998
1444 4270
2253 3478
1646 5339
795 5577
1737 4556
371 5089
955 4868
536 5094
807 5921
288 5626
592 5635
2597 4586
1424 5882
2870 4809
1664 5962
1943 3044
1154 5362
2488 3445
2888 3048
1536 4490
422 5438
827 3840
407 4863
750 4930
2525 3572
2519 5844
2026 4399
44 5765
2368 3162
588 3398...

output:

2918
1897 2861 2581 2156 676 1331 1872 362 2986 1118 1769 1454 2009 2799 290 2290 148 1612 2295 1666 1016 2388 1102 1599 1146 1103 2655 964 2847 2472 1450 1453 1030 2629 1494 660 1536 618 824 1001 1593 210 2325 476 2193 338 746 1485 793 2081 1591 2512 1025 2461 192 1726 2736 696 647 1830 2049 2698 2...

result:

ok accepted

Test #67:

score: 0
Accepted
time: 496ms
memory: 28476kb

input:

3000 3000 2998
2744 4199
2615 5957
1855 4369
2068 3891
1172 3210
2535 3216
2444 4130
2874 3034
1461 4171
9 4682
1887 5250
2492 5315
2861 3869
2738 5597
2174 3601
1286 3766
2819 4707
2088 5309
394 5194
2062 5371
2716 4029
1435 4005
1170 4938
203 3293
2782 5235
1557 3623
703 3584
2903 3730
299 5425
28...

output:

2228
2123 846 289 468 2638 2363 1192 178 1679 2548 2537 1681 2922 238 18 2545 209 718 1687 1938 462 1354 1413 1498 802 2243 2926 1837 2220 250 2278 1379 1635 2466 560 2375 881 2239 2682 2404 742 618 1815 1606 1373 932 1607 2143 1763 699 1195 2425 2138 1964 1845 2473 464 1285 2891 683 605 2663 437 27...

result:

ok accepted

Test #68:

score: 0
Accepted
time: 496ms
memory: 28684kb

input:

3000 3000 2998
1209 3777
2394 5629
2122 3086
2605 3539
1967 4707
1291 4325
1546 3818
2164 3202
1472 4031
1936 3661
303 4395
1622 3344
2688 4938
1991 5788
1021 4228
2686 4341
2984 3270
788 4266
2455 5827
619 3991
971 4304
1686 4162
1031 4885
422 4694
238 4014
2676 4951
2830 5712
202 4172
150 4078
132...

output:

1948
653 1668 1300 2488 2825 235 2731 1862 2443 2555 1457 1796 1752 283 1904 520 2598 2945 1871 1780 901 887 1123 654 1573 533 249 1663 1073 1371 1367 124 526 972 1646 67 1127 476 2333 647 1806 1883 524 2862 1346 915 70 2920 2884 2716 1606 2445 1349 452 2365 2295 755 1917 1222 663 532 1157 2790 39 2...

result:

ok accepted

Test #69:

score: 0
Accepted
time: 70ms
memory: 20084kb

input:

1 1 1
1 2

output:

1
1 

result:

ok accepted

Test #70:

score: 0
Accepted
time: 72ms
memory: 24308kb

input:

2 2 4
2 4
2 3
1 4
1 3

output:

2
4 1 

result:

ok accepted

Test #71:

score: 0
Accepted
time: 93ms
memory: 20744kb

input:

55 55 3000
1 101
49 91
29 87
42 56
52 81
26 60
3 59
37 99
19 91
37 64
34 104
14 82
47 62
27 56
33 84
22 92
4 106
40 63
28 109
34 100
2 83
3 76
13 74
37 58
30 105
43 78
4 99
27 88
34 90
49 83
2 69
14 74
31 62
45 69
34 74
20 62
28 106
19 92
24 83
43 77
38 62
8 58
28 85
51 109
51 56
7 105
2 102
8 73
17...

output:

870
2732 2718 2717 2997 2254 1817 2944 2780 2879 2835 2664 2741 2963 2692 2268 1923 1963 2840 2915 1833 1820 2607 2431 2519 2163 2887 2992 2950 1374 2586 2564 2560 2957 2205 2991 2947 495 2806 2956 2346 2980 2795 1862 2051 1621 2435 2904 2934 2625 2220 2756 1153 2905 2571 2814 1841 2530 2817 1801 23...

result:

ok accepted

Test #72:

score: 0
Accepted
time: 101ms
memory: 24488kb

input:

55 55 3000
43 78
18 83
8 90
25 95
15 86
27 56
49 64
55 67
38 71
33 80
23 82
5 67
6 95
48 102
22 96
46 99
32 85
46 63
40 108
22 58
7 90
3 80
44 95
12 96
41 84
50 66
16 97
10 57
32 63
6 65
47 88
19 64
16 76
26 102
16 110
7 77
17 106
47 93
27 62
19 103
28 98
21 73
38 104
40 61
49 57
13 94
20 83
32 86
2...

output:

1146
2946 2377 2914 2998 2974 1579 2902 2702 2135 2791 2775 2860 2624 2653 2632 2367 2751 2954 2878 2666 2879 2799 2761 2850 2618 2698 2789 2796 2146 2684 2318 2771 2985 2927 720 2665 2884 2593 2474 2720 1275 2981 2928 2454 2970 2694 2908 2813 2380 2534 2305 2995 2992 2229 2875 2629 2073 938 2994 29...

result:

ok accepted

Test #73:

score: 0
Accepted
time: 97ms
memory: 24724kb

input:

55 55 3000
38 110
19 101
2 66
1 84
19 90
8 98
26 87
27 100
34 109
38 59
17 92
39 88
27 77
22 78
25 69
40 92
27 84
19 88
47 99
39 69
36 94
3 58
2 94
10 76
26 59
2 93
14 82
41 75
46 93
12 89
26 66
6 75
35 87
28 86
25 86
8 101
15 56
20 102
46 96
50 94
43 107
10 65
4 72
17 95
6 66
29 103
6 70
13 73
41 6...

output:

878
2991 2986 2650 1787 2798 2998 1723 2896 2859 2014 2643 2933 2194 2981 2777 1482 2719 2507 2521 2774 2589 2869 1817 2666 2881 2987 2008 2633 2873 1286 859 2149 2301 2856 2099 2664 2801 2916 2857 2885 2988 2888 2639 744 1369 2961 2955 2605 2970 1785 2490 2919 2849 2462 2048 2974 2897 2502 1810 149...

result:

ok accepted

Test #74:

score: 0
Accepted
time: 95ms
memory: 24608kb

input:

55 55 3000
23 82
40 70
12 78
38 71
31 105
47 77
42 62
50 62
30 85
50 83
44 83
23 81
54 91
8 109
5 61
23 92
22 82
25 109
27 100
55 90
17 68
4 91
25 79
12 77
16 88
40 56
23 78
10 71
52 60
31 56
34 98
18 72
22 64
5 71
42 78
39 68
29 67
35 77
14 95
12 109
5 89
23 94
6 80
38 56
28 91
38 109
2 99
19 105
3...

output:

1120
2656 2874 2899 2926 1941 2669 2804 1120 2770 2888 2960 2801 2998 2668 1769 2924 2795 1577 2717 2711 2985 2975 2925 2909 2655 2996 2903 2381 1475 2089 2028 2941 2881 2870 2872 2851 2991 2999 2940 1669 2847 2774 2796 402 2841 2912 2965 2372 1987 1237 1937 2666 1150 2898 2183 2280 2949 2564 2973 2...

result:

ok accepted

Test #75:

score: 0
Accepted
time: 97ms
memory: 24744kb

input:

55 55 3000
22 88
32 101
17 57
46 76
47 63
25 93
47 87
30 77
37 84
12 100
12 97
42 62
5 59
40 107
55 66
55 71
10 83
21 108
27 91
33 82
6 65
33 87
35 61
37 98
54 69
41 101
23 106
13 100
49 79
15 59
48 79
2 102
45 63
23 68
26 88
12 78
46 71
50 98
41 99
52 85
23 61
2 77
11 68
7 102
14 73
33 83
7 62
22 1...

output:

1138
1999 2772 2999 2815 264 2359 2694 2995 2733 2729 2708 2932 2651 1224 2786 2803 2907 2900 2280 2942 2724 2720 2687 2638 2956 2959 2526 2925 2598 2755 2068 2886 2654 2569 2738 2903 684 2365 2718 2664 546 2850 2049 2717 1489 2890 2970 2158 2912 2799 2982 2547 2948 2795 1737 2991 2465 2431 2998 164...

result:

ok accepted

Test #76:

score: 0
Accepted
time: 76ms
memory: 22316kb

input:

54 54 2916
32 103
44 55
25 97
49 74
41 98
51 73
6 85
12 108
46 65
15 65
14 102
11 97
24 78
39 72
47 106
22 61
9 64
17 95
23 101
47 97
50 101
36 96
42 62
32 76
6 61
53 75
14 101
4 59
5 95
12 57
5 103
24 104
45 71
13 78
42 79
19 87
16 85
9 101
14 58
44 64
29 86
25 77
41 63
2 68
21 60
12 105
4 91
48 92...

output:

54
2511 44 101 47 2186 7 188 214 199 49 66 8 34 11 10 147 18 104 36 77 162 16 19 32 3 68 58 410 41 278 363 1 70 306 177 22 239 81 14 146 5 35 122 116 33 131 15 48 4 134 6 1307 26 224 

result:

ok accepted

Test #77:

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

input:

30 100 3000
24 50
27 78
16 110
4 98
23 35
2 127
14 66
11 37
13 65
26 80
29 49
17 111
2 37
8 56
30 44
18 84
15 104
22 33
4 96
16 87
9 67
11 62
8 106
22 118
11 63
5 68
11 39
18 82
15 80
23 78
11 40
1 71
6 79
8 88
3 47
26 102
16 101
17 108
22 128
30 70
16 98
5 90
18 116
20 32
9 101
22 59
7 93
2 118
14 ...

output:

30
2803 13 2765 935 545 967 814 2134 1666 2243 2661 717 2150 2790 1032 1188 1448 1807 2473 767 1320 2806 1793 75 490 2763 1532 1160 336 2905 

result:

ok accepted

Test #78:

score: 0
Accepted
time: 83ms
memory: 20808kb

input:

1 3000 3000
1 1538
1 1870
1 2459
1 2131
1 590
1 70
1 2995
1 2523
1 1896
1 702
1 769
1 2011
1 467
1 534
1 1228
1 2582
1 952
1 1092
1 2265
1 2657
1 2188
1 122
1 2992
1 827
1 323
1 2495
1 2088
1 877
1 210
1 1852
1 1237
1 278
1 1363
1 2993
1 1209
1 2733
1 1992
1 839
1 389
1 2885
1 1393
1 1328
1 507
1 20...

output:

0

result:

ok accepted

Test #79:

score: 0
Accepted
time: 159ms
memory: 24804kb

input:

2 1500 3000
2 1407
2 135
1 703
1 728
1 334
1 1034
1 1307
1 1389
2 1280
1 1361
1 366
1 1218
2 735
2 1079
2 1244
1 532
1 1491
2 108
2 1445
1 438
1 840
2 489
1 436
1 1468
2 249
1 225
1 719
1 596
2 680
1 183
2 835
1 39
2 335
2 768
1 730
1 90
1 953
1 1287
2 1232
2 1231
2 1043
1 715
1 1483
1 414
2 91
1 13...

output:

2
825 1927 

result:

ok accepted

Test #80:

score: 0
Accepted
time: 84ms
memory: 24696kb

input:

10 300 3000
10 98
5 272
2 285
1 178
10 101
3 82
9 11
3 293
10 249
8 255
3 186
5 173
6 227
3 57
9 172
7 127
4 124
10 103
10 192
4 266
8 67
8 292
7 177
7 184
3 90
3 122
6 139
8 279
2 256
8 139
3 74
4 286
7 18
5 253
1 261
8 141
1 80
10 97
4 183
9 298
4 191
4 297
10 201
1 231
5 58
6 279
1 293
4 233
5 83...

output:

10
2152 2020 716 1341 746 2642 509 544 2846 98 

result:

ok accepted