QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#313235#8142. ElevatorPetroTarnavskyi#AC ✓392ms32760kbC++201.0kb2024-01-24 16:48:512024-01-24 16:48:52

Judging History

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

  • [2024-01-24 16:48:52]
  • 评测
  • 测评结果:AC
  • 用时:392ms
  • 内存:32760kb
  • [2024-01-24 16:48:51]
  • 提交

answer

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>


using namespace __gnu_pbds;
using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (a) - 1; i >= (b); i--)
#define SZ(a) int(a.size())
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair
#define F first
#define S second

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef double db;
typedef tree<int, null_type, less<int>,
		rb_tree_tag,
		tree_order_statistics_node_update> ordered_set;


int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int n, m;
	cin >> n >> m;
	LL s1 = 0;
	vector<PII> a(n);
	FOR (i, 0, n)
	{
		cin >> a[i].F;
		a[i].S = i;
	}
	sort(ALL(a));
	ordered_set s;
	VI ans(n);
	FOR (i, 0, n)
	{
		LL x = (LL)i * a[i].F - s1 + s.order_of_key(a[i].S);
		if (x > m - 2)
			ans[a[i].S] = -1;
		else
			ans[a[i].S] = x;
		s.insert(a[i].S);
		s1 += a[i].F;
	}
	FOR (i, 0, n)
		cout << ans[i] << '\n';
	
	return 0;
}


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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

6 20
3 8 12 6 9 9

output:

0
8
-1
4
13
14

result:

ok 6 lines

Test #2:

score: 0
Accepted
time: 280ms
memory: 32336kb

input:

500000 1000000000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
10...

result:

ok 500000 lines

Test #3:

score: 0
Accepted
time: 269ms
memory: 32276kb

input:

500000 10000000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
10...

result:

ok 500000 lines

Test #4:

score: 0
Accepted
time: 274ms
memory: 32336kb

input:

500000 1000000000
3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 ...

output:

0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
10...

result:

ok 500000 lines

Test #5:

score: 0
Accepted
time: 279ms
memory: 32396kb

input:

500000 1000000000
4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 ...

output:

0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
10...

result:

ok 500000 lines

Test #6:

score: 0
Accepted
time: 279ms
memory: 32284kb

input:

500000 1000000000
5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 ...

output:

0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
10...

result:

ok 500000 lines

Test #7:

score: 0
Accepted
time: 274ms
memory: 32264kb

input:

500000 1000000000
6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 ...

output:

0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
10...

result:

ok 500000 lines

Test #8:

score: 0
Accepted
time: 271ms
memory: 32756kb

input:

500000 1000000000
7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 ...

output:

0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
10...

result:

ok 500000 lines

Test #9:

score: 0
Accepted
time: 274ms
memory: 32404kb

input:

500000 1000000000
8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 ...

output:

0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
10...

result:

ok 500000 lines

Test #10:

score: 0
Accepted
time: 147ms
memory: 20784kb

input:

300000 200000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
10...

result:

ok 300000 lines

Test #11:

score: 0
Accepted
time: 156ms
memory: 20720kb

input:

300000 200000
3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 ...

output:

0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
10...

result:

ok 300000 lines

Test #12:

score: 0
Accepted
time: 153ms
memory: 20824kb

input:

300000 1000000000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
10...

result:

ok 300000 lines

Test #13:

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

input:

100 1000000000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

output:

0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99

result:

ok 100 lines

Test #14:

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

input:

100 10
3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3

output:

0
1
2
3
4
5
6
7
8
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1

result:

ok 100 lines

Test #15:

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

input:

5 1000000000
114514 1919810 42 188888888 987654321

output:

114472
3725065
0
564632301
-1

result:

ok 5 lines

Test #16:

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

input:

2 1000000000
1000000000 1

output:

-1
0

result:

ok 2 lines

Test #17:

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

input:

70 1000000000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

output:

0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69

result:

ok 70 lines

Test #18:

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

input:

10 10
1 1 1 1 1 1 1 1 1 1

output:

0
1
2
3
4
5
6
7
8
-1

result:

ok 10 lines

Test #19:

score: 0
Accepted
time: 279ms
memory: 32388kb

input:

500000 1000000000
3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 ...

output:

0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
10...

result:

ok 500000 lines

Test #20:

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

input:

200000 1000000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
10...

result:

ok 200000 lines

Test #21:

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

input:

200000 1000000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
10...

result:

ok 200000 lines

Test #22:

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

input:

500000 10000
3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3...

output:

0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
10...

result:

ok 500000 lines

Test #23:

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

input:

50 1000000000
3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3

output:

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

result:

ok 50 lines

Test #24:

score: 0
Accepted
time: 213ms
memory: 26516kb

input:

400000 1000000000
3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 ...

output:

0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
10...

result:

ok 400000 lines

Test #25:

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

input:

400000 200000
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

output:

0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
10...

result:

ok 400000 lines

Test #26:

score: 0
Accepted
time: 388ms
memory: 32292kb

input:

500000 1000000000
998524640 998571529 998454399 998672383 998672780 998505456 998528789 998304951 998394266 998666568 998435296 998244658 998486721 998408564 998281668 998344975 998602953 998355446 998505615 998560074 998649209 998662668 998411769 998619635 998542652 998506747 998540826 998333379 99...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
46665
-1
-1
696223271
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
713192030
-1
18069067
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
9903476
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
12497502
-1
-1
-1
-1
-1...

result:

ok 500000 lines

Test #27:

score: 0
Accepted
time: 392ms
memory: 32396kb

input:

500000 1000000000
934281838 934263192 934287286 934239743 934243765 934262733 934291992 934256023 934265169 934258780 934246083 934251685 934273017 934274158 934264586 934284605 934285579 934244407 934281377 934266910 934249796 934277949 934295862 934242028 934266412 934259441 934247122 934256482 93...

output:

-1
-1
-1
106241065
317973223
-1
-1
-1
-1
-1
491437277
-1
-1
-1
-1
-1
-1
362250359
-1
-1
847669925
-1
-1
212639806
-1
-1
581397017
-1
-1
-1
-1
-1
-1
-1
286310432
542465181
-1
-1
59395980
82467
-1
-1
335968527
761678
-1
-1
-1
-1
-1
-1
-1
-1
-1
927691393
-1
-1
-1
-1
-1
542813828
-1
-1
-1
-1
103064160
3...

result:

ok 500000 lines

Test #28:

score: 0
Accepted
time: 366ms
memory: 32336kb

input:

500000 1000000000
999343307 999347629 999343355 999343249 999346214 999343949 999345974 999346616 999343167 999343390 999348863 999345664 999347085 999350711 999343996 999348680 999346311 999346834 999344902 999341562 999348239 999347549 999345200 999347878 999349864 999346595 999346033 999344493 99...

output:

106967300
-1
111989301
101052750
618890003
183670253
560624004
722937656
92977800
115723804
-1
489626256
854539060
-1
190095156
-1
643256410
782740512
335530807
2616300
-1
995560266
392337059
-1
-1
717302314
574680762
264794258
176159256
-1
355793911
542307664
30003001
-1
-1
-1
1316750
391545164
-1
...

result:

ok 500000 lines

Test #29:

score: 0
Accepted
time: 360ms
memory: 32760kb

input:

499999 1000000000
233333727 233334298 233334567 233334159 233334472 233333598 233334091 233334417 233333514 233334338 233333581 233333539 233334545 233334277 233333921 233333497 233334717 233333590 233333805 233334098 233333949 233333556 233333748 233333476 233334069 233334528 233333484 233334046 23...

output:

27235250
163133251
266698252
119542851
227230503
12335750
100681352
205824505
5764850
176930256
10806601
7462351
257277311
156114007
60608105
4735500
335447016
11603554
39069807
102548260
66512609
8741603
30212008
3603600
94925613
250113522
4016601
89089364
154136869
8741606
7607605
81039016
2389276...

result:

ok 499999 lines

Test #30:

score: 0
Accepted
time: 310ms
memory: 32276kb

input:

500000 1000000000
5 53 183 112 47 158 114 200 43 127 191 93 93 1 176 148 92 130 121 165 5 29 147 135 120 27 87 56 193 82 61 145 17 72 63 162 175 58 7 50 112 179 57 136 123 88 182 150 94 143 96 32 195 107 58 130 24 89 152 5 107 168 172 73 200 185 200 155 6 160 189 162 86 82 34 169 66 94 28 17 198 110...

output:

25000
3445001
41632502
15540002
2702501
31007504
16102504
49750007
2257501
20002506
45362509
10695004
10695005
0
38500011
27195010
10465005
20962511
18150010
33825015
25002
1015003
26827515
22612515
17850012
877503
9352508
3850008
46320027
8302509
4575009
26100022
340003
6390011
4882511
32602529
380...

result:

ok 500000 lines

Test #31:

score: 0
Accepted
time: 235ms
memory: 32276kb

input:

500000 1000000000
987654346 987654322 987654326 987654328 987654336 987654325 987654338 987654346 987654347 987654340 987654335 987654346 987654337 987654334 987654329 987654331 987654328 987654341 987654346 987654328 987654348 987654332 987654333 987654338 987654349 987654331 987654321 987654334 98...

output:

5687500
17500
262501
490002
2100003
175001
2677505
5687507
6142508
3325006
1837504
5687510
2380006
1592504
630004
962505
490004
3675013
5687517
490005
6615020
1155008
1365009
2677515
7105024
962508
0
1592513
3675021
1155011
17502
3675024
2100018
17503
1
2100021
5687533
787511
4830030
3325027
105005
...

result:

ok 500000 lines

Test #32:

score: 0
Accepted
time: 250ms
memory: 32324kb

input:

500000 1000000000
999999925 999999925 999999924 999999923 999999924 999999925 999999925 999999926 999999925 999999925 999999923 999999925 999999926 999999926 999999923 999999923 999999923 999999923 999999924 999999926 999999926 999999925 999999923 999999924 999999924 999999923 999999923 999999923 99...

output:

375000
375001
125000
0
125002
375005
375006
750007
375007
375008
1
375010
750012
750013
2
3
4
5
125008
750019
750020
375016
6
125010
125011
7
8
9
10
375024
11
125017
12
375028
375029
750035
750036
375030
125019
750039
375032
125020
125021
375035
375036
750045
13
375038
750048
750049
125023
125024
14...

result:

ok 500000 lines

Test #33:

score: 0
Accepted
time: 263ms
memory: 32336kb

input:

500000 1000000000
754193961 754193961 754193962 754193961 754193961 754193961 754193962 754193961 754193961 754193961 754193962 754193961 754193961 754193961 754193961 754193961 754193961 754193961 754193961 754193961 754193962 754193962 754193961 754193962 754193962 754193961 754193961 754193961 75...

output:

0
1
250002
2
3
4
250006
5
6
7
250010
8
9
10
11
12
13
14
15
16
250020
250021
17
250023
250024
18
19
20
250028
21
250030
250031
250032
250033
250034
250035
250036
250037
250038
250039
22
23
250042
250043
250044
250045
250046
24
250048
250049
250050
250051
25
26
250054
27
28
250057
29
30
250060
250061
...

result:

ok 500000 lines

Test #34:

score: 0
Accepted
time: 286ms
memory: 32260kb

input:

500000 1000000000
338919691 338919691 338919691 338919691 338919691 338919691 338919691 338919691 338919691 338919691 338919691 338919691 338919691 338919691 338919691 338919691 338919691 338919691 338919691 338919691 338919691 338919691 338919691 338919691 338919691 338919691 338919691 338919691 33...

output:

0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
10...

result:

ok 500000 lines

Test #35:

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

input:

10 1000000000
945194997 993149307 561560517 986298691 890390071 998287269 780780220 972597460 996574615 123121111

output:

-1
-1
438439406
-1
-1
-1
876878813
-1
-1
0

result:

ok 10 lines

Test #36:

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

input:

20 1000000000
971326041 999426470 999405884 943218749 992406510 887004166 999213744 997676627 999378435 998994156 995919921 549716666 985379687 100000000 774574999 999323538 999429901 999431617 999419608 998554980

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
449716666
-1
0
899433334
-1
-1
-1
-1
-1

result:

ok 20 lines

Test #37:

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

input:

40 1000000000
188015433 462940501 462939977 462940501 462806261 462940493 462940501 458644797 462923721 462940501 462936306 462940500 461866575 462940501 454349093 462939453 428574868 394209234 462932111 462906941 462940501 462940436 445757685 462940485 462940499 462940501 462873381 462940469 462940...

output:

0
549850128
549839127
549850130
548105013
549849915
549850133
515484503
549581655
549850136
549774626
549850105
539110876
549850140
489710279
549829177
378021971
274925069
549707510
549346739
549850147
549848582
446753241
549849727
549850087
549850152
548910460
549849344
549850035
543943548
54985015...

result:

ok 40 lines

Test #38:

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

input:

80 1000000000
999999999 999999999 993133767 999999999 999999999 999999999 890140277 972535069 999999999 986267534 999999999 999999999 999999999 999999161 999999999 999999999 999999993 999999999 999998323 560561111 999785430 999999999 999141720 999999999 999999999 999999999 999999999 999999998 999946...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
439438889
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
0
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
878877779
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1

result:

ok 80 lines

Extra Test:

score: 0
Extra Test Passed