QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#20339#2425. The Collection Gameuezexh#100 ✓11ms3336kbC++201.3kb2022-02-15 17:04:082022-05-03 09:39:40

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 09:39:40]
  • 评测
  • 测评结果:100
  • 用时:11ms
  • 内存:3336kb
  • [2022-02-15 17:04:08]
  • 提交

answer

#include "swaps.h"
#include <array>
#include <vector>
#include <utility>
using namespace std;

void solve(int N,int V){
	vector<int> v(N);
	for(int i=0;i<N;++i)
		v[i]=i+1;
	auto Get=[](int n){
		int k=1;
		while((k<<1)<n)
			k<<=1;
		return k;
	};
	vector<pair<vector<array<int,3>>,int>> a;
	vector<array<int,3>> b,c;
	a.emplace_back(vector{array{0,N,0}},0);
	while(a.size()){
		if(a.back().second==0){
			vector<array<int,3>> node_a;
			for(auto &[p,n,dir]:a.back().first){
				if(n>1){
					int m=(n>>1);
					node_a.push_back({p,m,!dir});
					node_a.push_back({p+m,n-m,dir});
				}
			}
			a.back().second=1;
			if(node_a.size())
				a.emplace_back(vector{node_a},0);
		}else{
			for(auto &_:a.back().first)
				b.push_back(_);
			while(b.size()){
				size_t __=0;
				c.clear();
				for(auto &[p,n,dir]:b){
					if(n>1){
						int m=Get(n);
						for(int i=p;i<p+n-m;++i)
							schedule(v[i],v[i+m]);
						++__;
					}
				}
				auto _=(__?visit():vector<int>());
				__=0;
				for(auto &[p,n,dir]:b){
					if(n>1){
						int m=Get(n);
						for(int i=p;i<p+n-m;++i)
							if(_[__++]==dir)
								swap(v[i],v[i+m]);
						c.push_back({p,m,dir});
						c.push_back({p+m,n-m,dir});
					}
				}
				b=c;
			}
			a.pop_back();
		}
	}
	answer(v);
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Accepted

Test #1:

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

input:

4 50
2 0 0
2 1 0
2 0 1

output:

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

result:

points 1.0 points  1.0 Correct

Subtask #2:

score: 5
Accepted

Test #2:

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

input:

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

output:

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

result:

points 1.0 points  1.0 Correct

Test #3:

score: 0
Accepted
time: 4ms
memory: 3204kb

input:

100 5000
36 0 0 0 1 0 1 0 1 1 0 1 0 1 0 0 0 0 1 1 0 1 1 0 1 0 0 0 0 0 0 0 1 1 1 1 0
36 0 1 1 1 0 0 0 0 1 0 0 1 1 0 1 1 1 0 0 0 0 0 0 1 0 0 0 0 0 1 0 1 1 0 0 1
36 0 0 1 1 0 1 0 0 1 0 1 1 0 1 0 1 1 1 0 0 0 0 0 0 0 1 0 0 0 0 0 1 1 0 1 1
36 0 1 1 1 0 0 0 1 1 0 0 1 1 0 1 0 0 0 1 1 0 1 0 1 1 0 0 1 1 1 0 1...

output:

946149565 2 3
946149565 5 6
946149565 8 9
946149565 11 12
946149565 14 15
946149565 17 18
946149565 20 21
946149565 22 23
946149565 24 25
946149565 27 28
946149565 30 31
946149565 33 34
946149565 36 37
946149565 39 40
946149565 42 43
946149565 45 46
946149565 47 48
946149565 49 50
946149565 52 53
94...

result:

points 1.0 points  1.0 Correct

Test #4:

score: 0
Accepted
time: 4ms
memory: 3168kb

input:

250 5000
122 1 1 0 0 1 1 1 0 0 0 1 0 0 0 1 0 0 1 0 1 0 1 0 0 0 1 0 1 1 1 0 0 1 0 0 0 1 0 0 1 1 0 0 0 1 1 0 1 1 1 0 1 0 0 0 1 1 1 1 0 0 0 1 0 1 0 0 1 0 1 0 0 0 1 1 0 1 0 1 0 0 1 1 1 1 1 1 0 1 0 1 0 0 1 1 1 0 0 0 1 0 0 0 1 1 0 0 1 1 0 0 0 0 1 0 0 1 1 1 1 0 0
122 0 0 0 1 0 0 1 1 0 0 1 0 1 1 1 1 0 1 0 1...

output:

946149565 2 3
946149565 4 5
946149565 6 7
946149565 8 9
946149565 10 11
946149565 12 13
946149565 14 15
946149565 16 17
946149565 18 19
946149565 20 21
946149565 22 23
946149565 24 25
946149565 26 27
946149565 28 29
946149565 30 31
946149565 33 34
946149565 35 36
946149565 37 38
946149565 39 40
9461...

result:

points 1.0 points  1.0 Correct

Test #5:

score: 0
Accepted
time: 4ms
memory: 3184kb

input:

500 5000
244 1 1 0 1 1 1 0 1 0 1 1 0 0 0 0 0 0 1 1 1 0 1 1 1 0 1 0 0 1 1 0 1 1 1 0 1 0 1 0 1 0 1 1 0 0 1 1 0 1 1 0 0 0 1 1 0 0 1 1 0 0 0 0 1 0 0 1 1 0 0 1 1 0 1 0 0 1 1 0 1 1 0 1 0 1 1 0 1 1 0 1 1 0 1 1 1 0 0 1 1 0 0 1 0 0 0 1 1 1 0 0 0 0 1 0 1 1 1 1 0 0 0 0 1 0 1 0 1 1 1 1 1 0 1 0 0 1 0 1 0 1 1 0 0...

output:

946149565 2 3
946149565 4 5
946149565 6 7
946149565 8 9
946149565 10 11
946149565 12 13
946149565 14 15
946149565 16 17
946149565 18 19
946149565 20 21
946149565 22 23
946149565 24 25
946149565 26 27
946149565 28 29
946149565 30 31
946149565 33 34
946149565 35 36
946149565 37 38
946149565 39 40
9461...

result:

points 1.0 points  1.0 Correct

Test #6:

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

input:

500 5000
244 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 2 3
946149565 4 5
946149565 6 7
946149565 8 9
946149565 10 11
946149565 12 13
946149565 14 15
946149565 16 17
946149565 18 19
946149565 20 21
946149565 22 23
946149565 24 25
946149565 26 27
946149565 28 29
946149565 30 31
946149565 33 34
946149565 35 36
946149565 37 38
946149565 39 40
9461...

result:

points 1.0 points  1.0 Correct

Test #7:

score: 0
Accepted
time: 10ms
memory: 3212kb

input:

500 5000
244 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 2 3
946149565 4 5
946149565 6 7
946149565 8 9
946149565 10 11
946149565 12 13
946149565 14 15
946149565 16 17
946149565 18 19
946149565 20 21
946149565 22 23
946149565 24 25
946149565 26 27
946149565 28 29
946149565 30 31
946149565 33 34
946149565 35 36
946149565 37 38
946149565 39 40
9461...

result:

points 1.0 points  1.0 Correct

Test #8:

score: 0
Accepted
time: 10ms
memory: 3172kb

input:

500 5000
244 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0...

output:

946149565 2 3
946149565 4 5
946149565 6 7
946149565 8 9
946149565 10 11
946149565 12 13
946149565 14 15
946149565 16 17
946149565 18 19
946149565 20 21
946149565 22 23
946149565 24 25
946149565 26 27
946149565 28 29
946149565 30 31
946149565 33 34
946149565 35 36
946149565 37 38
946149565 39 40
9461...

result:

points 1.0 points  1.0 Correct

Test #9:

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

input:

500 5000
244 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1...

output:

946149565 2 3
946149565 4 5
946149565 6 7
946149565 8 9
946149565 10 11
946149565 12 13
946149565 14 15
946149565 16 17
946149565 18 19
946149565 20 21
946149565 22 23
946149565 24 25
946149565 26 27
946149565 28 29
946149565 30 31
946149565 33 34
946149565 35 36
946149565 37 38
946149565 39 40
9461...

result:

points 1.0 points  1.0 Correct

Subtask #3:

score: 10
Accepted

Test #10:

score: 10
Accepted
time: 11ms
memory: 3256kb

input:

500 1000
244 1 1 0 1 1 1 0 1 0 1 1 0 0 0 0 0 0 1 1 1 0 1 1 1 0 1 0 0 1 1 0 1 1 1 0 1 0 1 0 1 0 1 1 0 0 1 1 0 1 1 0 0 0 1 1 0 0 1 1 0 0 0 0 1 0 0 1 1 0 0 1 1 0 1 0 0 1 1 0 1 1 0 1 0 1 1 0 1 1 0 1 1 0 1 1 1 0 0 1 1 0 0 1 0 0 0 1 1 1 0 0 0 0 1 0 1 1 1 1 0 0 0 0 1 0 1 0 1 1 1 1 1 0 1 0 0 1 0 1 0 1 1 0 0...

output:

946149565 2 3
946149565 4 5
946149565 6 7
946149565 8 9
946149565 10 11
946149565 12 13
946149565 14 15
946149565 16 17
946149565 18 19
946149565 20 21
946149565 22 23
946149565 24 25
946149565 26 27
946149565 28 29
946149565 30 31
946149565 33 34
946149565 35 36
946149565 37 38
946149565 39 40
9461...

result:

points 1.0 points  1.0 Correct

Test #11:

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

input:

500 1000
244 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 2 3
946149565 4 5
946149565 6 7
946149565 8 9
946149565 10 11
946149565 12 13
946149565 14 15
946149565 16 17
946149565 18 19
946149565 20 21
946149565 22 23
946149565 24 25
946149565 26 27
946149565 28 29
946149565 30 31
946149565 33 34
946149565 35 36
946149565 37 38
946149565 39 40
9461...

result:

points 1.0 points  1.0 Correct

Test #12:

score: 0
Accepted
time: 8ms
memory: 3200kb

input:

500 1000
244 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 2 3
946149565 4 5
946149565 6 7
946149565 8 9
946149565 10 11
946149565 12 13
946149565 14 15
946149565 16 17
946149565 18 19
946149565 20 21
946149565 22 23
946149565 24 25
946149565 26 27
946149565 28 29
946149565 30 31
946149565 33 34
946149565 35 36
946149565 37 38
946149565 39 40
9461...

result:

points 1.0 points  1.0 Correct

Test #13:

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

input:

500 1000
244 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0...

output:

946149565 2 3
946149565 4 5
946149565 6 7
946149565 8 9
946149565 10 11
946149565 12 13
946149565 14 15
946149565 16 17
946149565 18 19
946149565 20 21
946149565 22 23
946149565 24 25
946149565 26 27
946149565 28 29
946149565 30 31
946149565 33 34
946149565 35 36
946149565 37 38
946149565 39 40
9461...

result:

points 1.0 points  1.0 Correct

Test #14:

score: 0
Accepted
time: 10ms
memory: 3240kb

input:

500 1000
244 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1...

output:

946149565 2 3
946149565 4 5
946149565 6 7
946149565 8 9
946149565 10 11
946149565 12 13
946149565 14 15
946149565 16 17
946149565 18 19
946149565 20 21
946149565 22 23
946149565 24 25
946149565 26 27
946149565 28 29
946149565 30 31
946149565 33 34
946149565 35 36
946149565 37 38
946149565 39 40
9461...

result:

points 1.0 points  1.0 Correct

Subtask #4:

score: 3
Accepted

Test #15:

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

input:

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

output:

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

result:

points 1.0 points  1.0 Correct

Test #16:

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

input:

100 5000
36 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
36 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
36 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
36 1 1 1 1 1 1 1 1 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 2 3
946149565 5 6
946149565 8 9
946149565 11 12
946149565 14 15
946149565 17 18
946149565 20 21
946149565 22 23
946149565 24 25
946149565 27 28
946149565 30 31
946149565 33 34
946149565 36 37
946149565 39 40
946149565 42 43
946149565 45 46
946149565 47 48
946149565 49 50
946149565 52 53
94...

result:

points 1.0 points  1.0 Correct

Subtask #5:

score: 2
Accepted

Dependency #4:

100%
Accepted

Test #17:

score: 2
Accepted
time: 4ms
memory: 3156kb

input:

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

output:

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

result:

points 1.0 points  1.0 Correct

Test #18:

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

input:

100 5000
36 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
36 0 0 1 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 1 1 1 1 1 0 1 1 0 0 1 1 0 1 1 1 1 0
36 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 1 0 1 0 1 0 1 0
36 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...

output:

946149565 2 3
946149565 5 6
946149565 8 9
946149565 11 12
946149565 14 15
946149565 17 18
946149565 20 21
946149565 22 23
946149565 24 25
946149565 27 28
946149565 30 31
946149565 33 34
946149565 36 37
946149565 39 40
946149565 42 43
946149565 45 46
946149565 47 48
946149565 49 50
946149565 52 53
94...

result:

points 1.0 points  1.0 Correct

Subtask #6:

score: 9
Accepted

Dependency #4:

100%
Accepted

Test #19:

score: 9
Accepted
time: 6ms
memory: 3188kb

input:

250 5000
122 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
122 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

946149565 2 3
946149565 4 5
946149565 6 7
946149565 8 9
946149565 10 11
946149565 12 13
946149565 14 15
946149565 16 17
946149565 18 19
946149565 20 21
946149565 22 23
946149565 24 25
946149565 26 27
946149565 28 29
946149565 30 31
946149565 33 34
946149565 35 36
946149565 37 38
946149565 39 40
9461...

result:

points 1.0 points  1.0 Correct

Test #20:

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

input:

500 5000
244 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 2 3
946149565 4 5
946149565 6 7
946149565 8 9
946149565 10 11
946149565 12 13
946149565 14 15
946149565 16 17
946149565 18 19
946149565 20 21
946149565 22 23
946149565 24 25
946149565 26 27
946149565 28 29
946149565 30 31
946149565 33 34
946149565 35 36
946149565 37 38
946149565 39 40
9461...

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: 3184kb

input:

250 5000
122 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
122 1 0 1 0 1 1 0 1 0 1 0 1 0 0 0 1 0 0 1 0...

output:

946149565 2 3
946149565 4 5
946149565 6 7
946149565 8 9
946149565 10 11
946149565 12 13
946149565 14 15
946149565 16 17
946149565 18 19
946149565 20 21
946149565 22 23
946149565 24 25
946149565 26 27
946149565 28 29
946149565 30 31
946149565 33 34
946149565 35 36
946149565 37 38
946149565 39 40
9461...

result:

points 1.0 points  1.0 Correct

Test #22:

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

input:

500 5000
244 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 2 3
946149565 4 5
946149565 6 7
946149565 8 9
946149565 10 11
946149565 12 13
946149565 14 15
946149565 16 17
946149565 18 19
946149565 20 21
946149565 22 23
946149565 24 25
946149565 26 27
946149565 28 29
946149565 30 31
946149565 33 34
946149565 35 36
946149565 37 38
946149565 39 40
9461...

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: 6ms
memory: 3224kb

input:

500 500
244 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 2 3
946149565 4 5
946149565 6 7
946149565 8 9
946149565 10 11
946149565 12 13
946149565 14 15
946149565 16 17
946149565 18 19
946149565 20 21
946149565 22 23
946149565 24 25
946149565 26 27
946149565 28 29
946149565 30 31
946149565 33 34
946149565 35 36
946149565 37 38
946149565 39 40
9461...

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: 6ms
memory: 3336kb

input:

500 500
244 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 2 3
946149565 4 5
946149565 6 7
946149565 8 9
946149565 10 11
946149565 12 13
946149565 14 15
946149565 16 17
946149565 18 19
946149565 20 21
946149565 22 23
946149565 24 25
946149565 26 27
946149565 28 29
946149565 30 31
946149565 33 34
946149565 35 36
946149565 37 38
946149565 39 40
9461...

result:

points 1.0 points  1.0 Correct

Subtask #10:

score: 21
Accepted

Dependency #8:

100%
Accepted

Test #25:

score: 21
Accepted
time: 3ms
memory: 3228kb

input:

500 100
244 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 2 3
946149565 4 5
946149565 6 7
946149565 8 9
946149565 10 11
946149565 12 13
946149565 14 15
946149565 16 17
946149565 18 19
946149565 20 21
946149565 22 23
946149565 24 25
946149565 26 27
946149565 28 29
946149565 30 31
946149565 33 34
946149565 35 36
946149565 37 38
946149565 39 40
9461...

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: 1ms
memory: 3192kb

input:

500 100
244 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 2 3
946149565 4 5
946149565 6 7
946149565 8 9
946149565 10 11
946149565 12 13
946149565 14 15
946149565 16 17
946149565 18 19
946149565 20 21
946149565 22 23
946149565 24 25
946149565 26 27
946149565 28 29
946149565 30 31
946149565 33 34
946149565 35 36
946149565 37 38
946149565 39 40
9461...

result:

points 1.0 points  1.0 Correct

Subtask #12:

score: 9
Accepted

Dependency #10:

100%
Accepted

Test #27:

score: 9
Accepted
time: 11ms
memory: 3264kb

input:

500 50
244 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 2 3
946149565 4 5
946149565 6 7
946149565 8 9
946149565 10 11
946149565 12 13
946149565 14 15
946149565 16 17
946149565 18 19
946149565 20 21
946149565 22 23
946149565 24 25
946149565 26 27
946149565 28 29
946149565 30 31
946149565 33 34
946149565 35 36
946149565 37 38
946149565 39 40
9461...

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: 5ms
memory: 3224kb

input:

500 50
244 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 2 3
946149565 4 5
946149565 6 7
946149565 8 9
946149565 10 11
946149565 12 13
946149565 14 15
946149565 16 17
946149565 18 19
946149565 20 21
946149565 22 23
946149565 24 25
946149565 26 27
946149565 28 29
946149565 30 31
946149565 33 34
946149565 35 36
946149565 37 38
946149565 39 40
9461...

result:

points 1.0 points  1.0 Correct