QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#20535#2425. The Collection GameBinDir0#100 ✓13ms4244kbC++201.7kb2022-02-16 14:51:162022-05-03 10:26:24

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-05-03 10:26:24]
  • 评测
  • 测评结果:100
  • 用时:13ms
  • 内存:4244kb
  • [2022-02-16 14:51:16]
  • 提交

answer

#include <bits/stdc++.h>
#include "swaps.h"
using namespace std;
int p[550] , f[550] , t , N;
vector< int > ans , sav;
struct opt
{
	int x , y , d;
};
vector< opt > q[550];
void work( int x , int y , int a , int d )
{
	if(d != a) swap(p[x] , p[y]);
}
int sortbij( int l , int r , int d , int t )
{
	if(l == r) return t - 1;
	int mid = l + r >> 1 , it1 = l , it2 = mid + 1;
	while(it1 <= mid && it2 <= r)
	{
		q[t].push_back((opt){it1 , it2 , d});
		it1++; it2++;
	}
	return max(sortbij(l , mid , d , t + 1) , sortbij(mid + 1 , r , d , t + 1));
}
int sortseq( int l , int r , int d , int t )
{
	if(l == r) return t - 1;
	int mid = l + r >> 1;
	int qwq = max(sortseq(l , mid , d , t) , sortseq(mid + 1 , r , d ^ 1 , t)) + 1;
	return sortbij(l , r , d , qwq);
}
void solve( int n , int lim ) 
{
	N = n; n = (1 << ((int)log2(n - 1) + 1));
//	cerr << N << ' ' << n << endl;
	for(int i = 1 ; i <= n ; i++ ) p[i] = i;
	t = sortseq(1 , n , 1 , 1);
	for(int i = 1 ; i <= t ; i++ )
	{
		for(opt qwq : q[i]) 
			if(p[qwq.x] <= N && p[qwq.y] <= N) schedule(p[qwq.x] , p[qwq.y]);
//		for(opt qwq : q[i]) cerr << qwq.x << ' ' << qwq.y << ' ' << qwq.d << endl;
//		cerr << endl;
		sav = visit(); int it = 0; ans.clear();
		for(opt qwq : q[i]) 
		{
			if(p[qwq.x] <= N && p[qwq.y] <= N) ans.push_back(sav[it]) , it++;
			if(p[qwq.x] <= N && p[qwq.y] > N) ans.push_back(1);
			if(p[qwq.x] > N && p[qwq.y] <= N) ans.push_back(0);
			if(p[qwq.x] > N && p[qwq.y] > N) ans.push_back(p[qwq.x] < p[qwq.y]);
		}
		for(int j = 0 ; j < q[i].size() ; j++ )
			work(q[i][j].x , q[i][j].y , q[i][j].d , ans[j]);
	}
	vector< int > q;
	for(int i = 1 ; i <= N ; i++ ) q.push_back(p[i]);
	answer(q);
}
/*
5 123
5 3 4 2 1
*/

詳細信息

Subtask #1:

score: 0
Accepted

Test #1:

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

input:

4 50
2 0 0
2 1 0
2 0 1

output:

946149565 3 4
946149565 1 2
547293220
946149565 2 3
946149565 1 4
547293220
946149565 3 1
946149565 2 4
547293220
345685428 2 4 1 3

result:

points 1.0 points  1.0 Correct

Subtask #2:

score: 5
Accepted

Test #2:

score: 5
Accepted
time: 4ms
memory: 3956kb

input:

10 5000
5 0 0 0 0 0
4 0 1 1 0
5 0 0 1 1 0
4 1 1 1 0
4 0 1 1 0
5 0 1 1 0 0
2 0 0
4 1 1 1 0
4 0 0 1 1
5 1 1 0 1 1

output:

946149565 9 10
946149565 7 8
946149565 5 6
946149565 3 4
946149565 1 2
547293220
946149565 5 8
946149565 6 7
946149565 2 3
946149565 1 4
547293220
946149565 9 10
946149565 8 6
946149565 5 7
946149565 3 1
946149565 2 4
547293220
946149565 4 7
946149565 2 5
946149565 3 8
946149565 1 6
547293220
946149...

result:

points 1.0 points  1.0 Correct

Test #3:

score: 0
Accepted
time: 5ms
memory: 3884kb

input:

100 5000
50 0 1 1 1 1 1 0 0 0 0 0 0 1 0 1 0 1 0 0 1 1 0 0 1 0 1 0 0 1 1 0 0 0 0 0 0 0 1 0 0 0 1 0 0 1 1 1 0 1 0
50 1 0 0 0 0 0 0 0 1 0 1 1 1 0 1 0 0 1 1 1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1 1 1 0 1 1 0 1 0 0 1 1 0 1 1 0
50 0 0 1 0 1 0 1 0 0 0 0 1 0 0 0 0 1 1 0 1 0 1 0 0 1 0 1 0 1 0 1 0 1 1 0 1 1 0 0 1 1 ...

output:

946149565 99 100
946149565 97 98
946149565 95 96
946149565 93 94
946149565 91 92
946149565 89 90
946149565 87 88
946149565 85 86
946149565 83 84
946149565 81 82
946149565 79 80
946149565 77 78
946149565 75 76
946149565 73 74
946149565 71 72
946149565 69 70
946149565 67 68
946149565 65 66
946149565 6...

result:

points 1.0 points  1.0 Correct

Test #4:

score: 0
Accepted
time: 3ms
memory: 4020kb

input:

250 5000
125 0 0 1 1 1 1 0 0 1 0 0 0 0 1 1 0 0 1 1 0 0 0 1 0 0 0 1 1 1 0 0 0 0 0 0 1 0 0 0 0 0 1 1 1 1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 0 1 0 0 1 1 1 0 0 0 1 1 0 1 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 0 1 1 1 1 0 1 1 1 0 1 0 0 0 1 0 1 0 1 0 0 0 1 0 1 0 0 1 1 0 0 0 0 1 0 0 0
124 0 1 0 0 0 0 1 0 1 0 1 1 0 1 1 0 0...

output:

946149565 249 250
946149565 247 248
946149565 245 246
946149565 243 244
946149565 241 242
946149565 239 240
946149565 237 238
946149565 235 236
946149565 233 234
946149565 231 232
946149565 229 230
946149565 227 228
946149565 225 226
946149565 223 224
946149565 221 222
946149565 219 220
946149565 21...

result:

points 1.0 points  1.0 Correct

Test #5:

score: 0
Accepted
time: 11ms
memory: 4116kb

input:

500 5000
250 0 0 1 0 0 0 0 0 1 0 1 1 1 0 1 1 1 0 1 1 0 0 1 0 1 0 0 1 0 0 1 1 0 0 0 0 1 1 0 0 0 0 0 1 0 1 0 1 1 0 0 0 1 1 0 0 0 1 1 0 1 0 1 1 1 1 1 0 1 0 0 1 0 1 0 0 1 1 1 1 1 0 1 1 1 1 1 0 0 1 0 0 0 1 0 0 1 0 0 0 1 1 0 0 1 1 0 1 0 0 1 1 1 0 1 1 0 0 0 1 1 0 0 1 1 0 0 0 1 1 1 1 0 1 0 0 0 0 1 1 1 0 0 0...

output:

946149565 499 500
946149565 497 498
946149565 495 496
946149565 493 494
946149565 491 492
946149565 489 490
946149565 487 488
946149565 485 486
946149565 483 484
946149565 481 482
946149565 479 480
946149565 477 478
946149565 475 476
946149565 473 474
946149565 471 472
946149565 469 470
946149565 46...

result:

points 1.0 points  1.0 Correct

Test #6:

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

input:

500 5000
250 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

946149565 499 500
946149565 497 498
946149565 495 496
946149565 493 494
946149565 491 492
946149565 489 490
946149565 487 488
946149565 485 486
946149565 483 484
946149565 481 482
946149565 479 480
946149565 477 478
946149565 475 476
946149565 473 474
946149565 471 472
946149565 469 470
946149565 46...

result:

points 1.0 points  1.0 Correct

Test #7:

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

input:

500 5000
250 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

946149565 499 500
946149565 497 498
946149565 495 496
946149565 493 494
946149565 491 492
946149565 489 490
946149565 487 488
946149565 485 486
946149565 483 484
946149565 481 482
946149565 479 480
946149565 477 478
946149565 475 476
946149565 473 474
946149565 471 472
946149565 469 470
946149565 46...

result:

points 1.0 points  1.0 Correct

Test #8:

score: 0
Accepted
time: 7ms
memory: 4128kb

input:

500 5000
250 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

946149565 499 500
946149565 497 498
946149565 495 496
946149565 493 494
946149565 491 492
946149565 489 490
946149565 487 488
946149565 485 486
946149565 483 484
946149565 481 482
946149565 479 480
946149565 477 478
946149565 475 476
946149565 473 474
946149565 471 472
946149565 469 470
946149565 46...

result:

points 1.0 points  1.0 Correct

Test #9:

score: 0
Accepted
time: 3ms
memory: 4096kb

input:

500 5000
250 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

946149565 499 500
946149565 497 498
946149565 495 496
946149565 493 494
946149565 491 492
946149565 489 490
946149565 487 488
946149565 485 486
946149565 483 484
946149565 481 482
946149565 479 480
946149565 477 478
946149565 475 476
946149565 473 474
946149565 471 472
946149565 469 470
946149565 46...

result:

points 1.0 points  1.0 Correct

Subtask #3:

score: 10
Accepted

Test #10:

score: 10
Accepted
time: 9ms
memory: 4116kb

input:

500 1000
250 0 0 1 0 0 0 0 0 1 0 1 1 1 0 1 1 1 0 1 1 0 0 1 0 1 0 0 1 0 0 1 1 0 0 0 0 1 1 0 0 0 0 0 1 0 1 0 1 1 0 0 0 1 1 0 0 0 1 1 0 1 0 1 1 1 1 1 0 1 0 0 1 0 1 0 0 1 1 1 1 1 0 1 1 1 1 1 0 0 1 0 0 0 1 0 0 1 0 0 0 1 1 0 0 1 1 0 1 0 0 1 1 1 0 1 1 0 0 0 1 1 0 0 1 1 0 0 0 1 1 1 1 0 1 0 0 0 0 1 1 1 0 0 0...

output:

946149565 499 500
946149565 497 498
946149565 495 496
946149565 493 494
946149565 491 492
946149565 489 490
946149565 487 488
946149565 485 486
946149565 483 484
946149565 481 482
946149565 479 480
946149565 477 478
946149565 475 476
946149565 473 474
946149565 471 472
946149565 469 470
946149565 46...

result:

points 1.0 points  1.0 Correct

Test #11:

score: 0
Accepted
time: 11ms
memory: 4044kb

input:

500 1000
250 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

946149565 499 500
946149565 497 498
946149565 495 496
946149565 493 494
946149565 491 492
946149565 489 490
946149565 487 488
946149565 485 486
946149565 483 484
946149565 481 482
946149565 479 480
946149565 477 478
946149565 475 476
946149565 473 474
946149565 471 472
946149565 469 470
946149565 46...

result:

points 1.0 points  1.0 Correct

Test #12:

score: 0
Accepted
time: 6ms
memory: 4096kb

input:

500 1000
250 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

946149565 499 500
946149565 497 498
946149565 495 496
946149565 493 494
946149565 491 492
946149565 489 490
946149565 487 488
946149565 485 486
946149565 483 484
946149565 481 482
946149565 479 480
946149565 477 478
946149565 475 476
946149565 473 474
946149565 471 472
946149565 469 470
946149565 46...

result:

points 1.0 points  1.0 Correct

Test #13:

score: 0
Accepted
time: 11ms
memory: 4104kb

input:

500 1000
250 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

946149565 499 500
946149565 497 498
946149565 495 496
946149565 493 494
946149565 491 492
946149565 489 490
946149565 487 488
946149565 485 486
946149565 483 484
946149565 481 482
946149565 479 480
946149565 477 478
946149565 475 476
946149565 473 474
946149565 471 472
946149565 469 470
946149565 46...

result:

points 1.0 points  1.0 Correct

Test #14:

score: 0
Accepted
time: 3ms
memory: 4128kb

input:

500 1000
250 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

946149565 499 500
946149565 497 498
946149565 495 496
946149565 493 494
946149565 491 492
946149565 489 490
946149565 487 488
946149565 485 486
946149565 483 484
946149565 481 482
946149565 479 480
946149565 477 478
946149565 475 476
946149565 473 474
946149565 471 472
946149565 469 470
946149565 46...

result:

points 1.0 points  1.0 Correct

Subtask #4:

score: 3
Accepted

Test #15:

score: 3
Accepted
time: 4ms
memory: 3928kb

input:

10 5000
5 1 1 1 1 1
4 1 1 1 1
5 1 1 1 1 1
4 1 1 1 1
4 1 1 1 1
5 1 1 1 1 1
2 1 1
4 1 1 1 1
4 1 1 1 1
5 1 1 1 1 1

output:

946149565 9 10
946149565 7 8
946149565 5 6
946149565 3 4
946149565 1 2
547293220
946149565 6 7
946149565 5 8
946149565 1 4
946149565 2 3
547293220
946149565 10 9
946149565 6 5
946149565 7 8
946149565 4 3
946149565 1 2
547293220
946149565 1 8
946149565 2 7
946149565 4 5
946149565 3 6
547293220
946149...

result:

points 1.0 points  1.0 Correct

Test #16:

score: 0
Accepted
time: 5ms
memory: 3964kb

input:

100 5000
50 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
50 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
50 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

946149565 99 100
946149565 97 98
946149565 95 96
946149565 93 94
946149565 91 92
946149565 89 90
946149565 87 88
946149565 85 86
946149565 83 84
946149565 81 82
946149565 79 80
946149565 77 78
946149565 75 76
946149565 73 74
946149565 71 72
946149565 69 70
946149565 67 68
946149565 65 66
946149565 6...

result:

points 1.0 points  1.0 Correct

Subtask #5:

score: 2
Accepted

Dependency #4:

100%
Accepted

Test #17:

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

input:

10 5000
5 1 0 1 0 0
4 0 1 1 0
5 1 0 0 1 1
4 1 0 0 1
4 1 0 0 1
5 0 0 0 0 1
2 0 1
4 0 1 1 1
4 0 1 0 0
5 0 1 0 1 0

output:

946149565 9 10
946149565 7 8
946149565 5 6
946149565 3 4
946149565 1 2
547293220
946149565 6 8
946149565 5 7
946149565 2 3
946149565 1 4
547293220
946149565 10 9
946149565 8 5
946149565 6 7
946149565 3 1
946149565 2 4
547293220
946149565 2 6
946149565 4 7
946149565 3 8
946149565 1 5
547293220
946149...

result:

points 1.0 points  1.0 Correct

Test #18:

score: 0
Accepted
time: 3ms
memory: 3952kb

input:

100 5000
50 0 0 0 0 1 1 1 0 0 1 1 0 1 0 1 1 1 1 1 0 1 0 0 0 0 1 1 0 0 1 0 0 1 1 1 1 0 0 1 0 0 0 0 0 0 0 0 1 0 1
50 0 1 0 1 1 1 1 1 1 0 1 1 0 0 1 1 0 1 1 1 1 0 1 0 1 1 1 1 1 1 1 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 0 1 0
50 1 0 1 0 1 0 1 0 0 1 0 0 1 0 0 0 1 1 1 0 0 0 1 1 1 1 1 0 0 1 0 1 0 1 0 1 0 0 1 1 1 ...

output:

946149565 99 100
946149565 97 98
946149565 95 96
946149565 93 94
946149565 91 92
946149565 89 90
946149565 87 88
946149565 85 86
946149565 83 84
946149565 81 82
946149565 79 80
946149565 77 78
946149565 75 76
946149565 73 74
946149565 71 72
946149565 69 70
946149565 67 68
946149565 65 66
946149565 6...

result:

points 1.0 points  1.0 Correct

Subtask #6:

score: 9
Accepted

Dependency #4:

100%
Accepted

Test #19:

score: 9
Accepted
time: 2ms
memory: 4020kb

input:

250 5000
125 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
124 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

946149565 249 250
946149565 247 248
946149565 245 246
946149565 243 244
946149565 241 242
946149565 239 240
946149565 237 238
946149565 235 236
946149565 233 234
946149565 231 232
946149565 229 230
946149565 227 228
946149565 225 226
946149565 223 224
946149565 221 222
946149565 219 220
946149565 21...

result:

points 1.0 points  1.0 Correct

Test #20:

score: 0
Accepted
time: 12ms
memory: 4244kb

input:

500 5000
250 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

946149565 499 500
946149565 497 498
946149565 495 496
946149565 493 494
946149565 491 492
946149565 489 490
946149565 487 488
946149565 485 486
946149565 483 484
946149565 481 482
946149565 479 480
946149565 477 478
946149565 475 476
946149565 473 474
946149565 471 472
946149565 469 470
946149565 46...

result:

points 1.0 points  1.0 Correct

Subtask #7:

score: 6
Accepted

Dependency #2:

100%
Accepted

Dependency #5:

100%
Accepted

Dependency #6:

100%
Accepted

Test #21:

score: 6
Accepted
time: 4ms
memory: 4020kb

input:

250 5000
125 0 0 0 1 1 0 1 0 0 0 0 0 0 0 1 0 1 0 0 0 1 1 1 0 0 0 0 1 0 1 1 0 1 1 0 0 0 1 1 1 1 1 0 1 0 0 0 1 1 1 1 1 1 1 0 0 1 0 1 1 0 1 0 1 1 1 0 1 1 0 0 0 0 1 1 1 0 0 1 1 1 1 1 1 1 1 0 1 0 0 1 1 1 0 0 0 0 0 1 1 0 1 0 0 1 1 1 1 0 1 1 1 0 0 0 0 1 1 0 1 1 0 1 0 1
124 0 1 1 0 1 0 1 0 1 0 0 0 1 0 0 1 0...

output:

946149565 249 250
946149565 247 248
946149565 245 246
946149565 243 244
946149565 241 242
946149565 239 240
946149565 237 238
946149565 235 236
946149565 233 234
946149565 231 232
946149565 229 230
946149565 227 228
946149565 225 226
946149565 223 224
946149565 221 222
946149565 219 220
946149565 21...

result:

points 1.0 points  1.0 Correct

Test #22:

score: 0
Accepted
time: 12ms
memory: 4244kb

input:

500 5000
250 0 0 1 1 0 1 0 1 0 1 0 0 0 0 1 1 1 0 1 1 0 0 0 1 0 1 1 0 0 1 0 0 0 1 1 0 1 0 0 1 1 0 1 0 1 0 1 0 0 0 1 0 1 0 0 1 0 1 1 0 1 0 1 1 0 0 0 0 0 1 1 1 1 0 1 1 1 0 0 0 1 1 1 0 1 1 1 0 0 0 0 1 1 0 0 0 1 1 0 1 0 1 1 0 0 1 1 0 0 0 0 0 0 0 1 1 0 0 0 1 0 1 0 1 1 0 0 0 1 0 1 1 0 0 1 1 0 1 0 1 1 0 0 1...

output:

946149565 499 500
946149565 497 498
946149565 495 496
946149565 493 494
946149565 491 492
946149565 489 490
946149565 487 488
946149565 485 486
946149565 483 484
946149565 481 482
946149565 479 480
946149565 477 478
946149565 475 476
946149565 473 474
946149565 471 472
946149565 469 470
946149565 46...

result:

points 1.0 points  1.0 Correct

Subtask #8:

score: 9
Accepted

Dependency #4:

100%
Accepted

Dependency #6:

100%
Accepted

Test #23:

score: 9
Accepted
time: 0ms
memory: 4044kb

input:

500 500
250 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

946149565 499 500
946149565 497 498
946149565 495 496
946149565 493 494
946149565 491 492
946149565 489 490
946149565 487 488
946149565 485 486
946149565 483 484
946149565 481 482
946149565 479 480
946149565 477 478
946149565 475 476
946149565 473 474
946149565 471 472
946149565 469 470
946149565 46...

result:

points 1.0 points  1.0 Correct

Subtask #9:

score: 6
Accepted

Dependency #3:

100%
Accepted

Dependency #7:

100%
Accepted

Dependency #8:

100%
Accepted

Test #24:

score: 6
Accepted
time: 11ms
memory: 4120kb

input:

500 500
250 0 0 0 1 0 1 0 0 1 0 0 0 1 0 0 0 1 1 1 0 1 1 1 1 0 1 0 0 1 0 1 1 0 1 1 1 0 1 1 1 0 0 1 1 1 1 1 0 0 0 1 1 0 1 1 1 0 1 0 1 1 1 0 0 1 0 0 1 0 1 1 0 1 1 1 0 0 1 1 0 1 0 0 1 1 1 0 0 1 1 0 1 1 1 1 0 1 0 0 1 0 0 1 0 1 1 1 1 0 0 0 0 0 1 1 0 0 0 1 0 0 1 1 1 1 0 0 0 1 0 1 1 1 1 0 0 1 1 1 0 1 0 0 0 ...

output:

946149565 499 500
946149565 497 498
946149565 495 496
946149565 493 494
946149565 491 492
946149565 489 490
946149565 487 488
946149565 485 486
946149565 483 484
946149565 481 482
946149565 479 480
946149565 477 478
946149565 475 476
946149565 473 474
946149565 471 472
946149565 469 470
946149565 46...

result:

points 1.0 points  1.0 Correct

Subtask #10:

score: 21
Accepted

Dependency #8:

100%
Accepted

Test #25:

score: 21
Accepted
time: 13ms
memory: 4072kb

input:

500 100
250 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

946149565 499 500
946149565 497 498
946149565 495 496
946149565 493 494
946149565 491 492
946149565 489 490
946149565 487 488
946149565 485 486
946149565 483 484
946149565 481 482
946149565 479 480
946149565 477 478
946149565 475 476
946149565 473 474
946149565 471 472
946149565 469 470
946149565 46...

result:

points 1.0 points  1.0 Correct

Subtask #11:

score: 14
Accepted

Dependency #9:

100%
Accepted

Dependency #10:

100%
Accepted

Test #26:

score: 14
Accepted
time: 7ms
memory: 4108kb

input:

500 100
250 0 1 1 0 1 1 1 0 1 1 0 1 0 1 1 0 0 0 1 1 0 1 1 1 0 1 0 1 1 0 0 1 1 0 0 0 1 0 0 1 0 1 1 0 1 1 1 0 0 0 1 1 0 0 0 1 0 1 0 1 0 1 0 1 1 0 1 1 1 0 0 1 1 0 0 0 1 0 0 1 0 0 1 0 1 1 0 0 0 0 0 1 0 1 0 0 0 1 1 1 1 1 1 0 1 0 0 0 0 1 1 0 0 1 1 0 1 1 1 1 0 1 0 0 0 1 0 1 0 0 1 1 1 0 0 0 0 0 0 1 0 0 1 1 ...

output:

946149565 499 500
946149565 497 498
946149565 495 496
946149565 493 494
946149565 491 492
946149565 489 490
946149565 487 488
946149565 485 486
946149565 483 484
946149565 481 482
946149565 479 480
946149565 477 478
946149565 475 476
946149565 473 474
946149565 471 472
946149565 469 470
946149565 46...

result:

points 1.0 points  1.0 Correct

Subtask #12:

score: 9
Accepted

Dependency #10:

100%
Accepted

Test #27:

score: 9
Accepted
time: 12ms
memory: 4220kb

input:

500 50
250 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

946149565 499 500
946149565 497 498
946149565 495 496
946149565 493 494
946149565 491 492
946149565 489 490
946149565 487 488
946149565 485 486
946149565 483 484
946149565 481 482
946149565 479 480
946149565 477 478
946149565 475 476
946149565 473 474
946149565 471 472
946149565 469 470
946149565 46...

result:

points 1.0 points  1.0 Correct

Subtask #13:

score: 6
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Dependency #6:

100%
Accepted

Dependency #7:

100%
Accepted

Dependency #8:

100%
Accepted

Dependency #9:

100%
Accepted

Dependency #10:

100%
Accepted

Dependency #11:

100%
Accepted

Dependency #12:

100%
Accepted

Test #28:

score: 6
Accepted
time: 8ms
memory: 4092kb

input:

500 50
250 1 1 1 0 1 1 0 1 0 1 1 1 1 0 1 1 0 1 1 0 0 0 0 1 1 1 1 0 1 1 0 1 1 1 0 0 0 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 1 0 0 0 1 1 1 1 0 1 1 1 0 1 0 1 0 0 0 1 1 0 1 0 1 0 1 1 0 1 0 0 0 1 1 0 1 0 1 0 0 1 0 1 1 1 1 0 0 1 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0 0 1 1 1 1 1 0 1 1 1 1 0 0 0 1 1 1 0 1 1 1 0 1...

output:

946149565 499 500
946149565 497 498
946149565 495 496
946149565 493 494
946149565 491 492
946149565 489 490
946149565 487 488
946149565 485 486
946149565 483 484
946149565 481 482
946149565 479 480
946149565 477 478
946149565 475 476
946149565 473 474
946149565 471 472
946149565 469 470
946149565 46...

result:

points 1.0 points  1.0 Correct