QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#842394#9968. Just Zerosucup-team6274#TL 1341ms104624kbC++236.2kb2025-01-04 12:23:252025-01-04 12:23:26

Judging History

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

  • [2025-01-04 12:23:26]
  • 评测
  • 测评结果:TL
  • 用时:1341ms
  • 内存:104624kb
  • [2025-01-04 12:23:25]
  • 提交

answer

// Problem: J. Just Zeros
// Contest: Universal Cup - The 3rd Universal Cup. Stage 24: Poland
// URL: https://contest.ucup.ac/contest/1890/problem/9968
// Memory Limit: 1024 MB
// Time Limit: 1000 ms
// Genshin Impact launch
// ZYB TXDY
// 
// Powered by CP Editor (https://cpeditor.org)

//%^~
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
// #include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <limits>
#include <climits>
#include <bitset>
#include <cassert>
#include <unordered_set>
#include <unordered_map>
#include <cmath>
#include <random>
// #include "ext/pb_ds/assoc_container.hpp"
// #include "ext/pb_ds/tree_policy.hpp"
// #include "ext/pb_ds/priority_queue.hpp"
// #include <ext/rope>
// #define PBDS __gnu_pbds
// #include <bits/extc++.h>
#define MAXN 200005
#define eps 1e-10
#define foru(a, b, c) for (int a = (b); (a) <= (c); (a)++)
#define ford(a, b, c) for (int a = (b); (a) >= (c); (a)++)
#define uLL unsigned long long
#define LL long long
#define LXF int
#define RIN Cap1taLDebug::read()
#define RSIN Cap1taLDebug::rdstr()
#define RCIN Cap1taLDebug::rdchar()
#define HH printf("\n")
#define All(x) (x).begin(), (x).end()
#define fi first
#define se second
#define CA const auto&
using namespace std;
// const int RANDOM = time(0);
// template<class T1,class T2>
// class tr1::hash<pair<T1,T2>>{
// public:
	// size_t operator () (pair<T1,T2> x)const{
		// tr1::hash<T1> H1;
		// tr1::hash<T2> H2;
		// return H1(x.fi)^H2(x.se)^RANDOM;
	// }
// };
int ID;
class Cap1taLDebug{
	#ifdef LXF
	#define READTYPE LXF
	#else
	#define READTYPE int
	#endif
	#define DEBUGING
private:
	ostream& buf;
	#ifndef DEBUGING
	static char fbuf[1<<21],*p1,*p2;
	#define getchar() (Cap1taLDebug::p1==p2&&(p1=(p2=fbuf)+fread(fbuf,1,1<<21,stdin),p1==p2)?EOF:*p2++)
	#endif
public:
	Cap1taLDebug(ostream& out=cout):buf(out){}
	~Cap1taLDebug(){
		#ifdef DEBUGING
		buf.flush();
		#endif
	}
	static READTYPE read(){
		READTYPE x=0,w=1;char ch=0;
		while(!isdigit(ch)){
		if(ch=='-')	w=-1;
		ch=getchar();
		}
		while(isdigit(ch))	x=x*10+(ch^48),ch=getchar();
		return x*w;
	}
	static string rdstr(){
		string s;char c=getchar();
		while(c==' ' || c=='\r' || c=='\n')	c=getchar();	
		while(c!=' ' && c!='\r' && c!='\n' && c!=EOF)	s+=c,c=getchar();
		return s;
	}
	static char rdchar(){
		char c=getchar();
		while(c==' ' || c=='\r' || c=='\n')	c=getchar();
		return c;
	}
	static string int128ToString(__int128 x){
		if(x==0)	return "0";
		string s="",w="";
		if(x<0)	w="-",x*=-1;
		while(x) s+=(char)('0'+(int)(x%10)),x/=10;
		reverse(All(s));
		return w+s;
	}
	Cap1taLDebug& operator<<(const string val){
		#ifdef DEBUGING
		buf<<val;
		#endif
		return *this;
	}
	template<typename T1,typename T2>
	Cap1taLDebug& operator<<(const pair<T1,T2>& val){
		#ifdef DEBUGING
		(*this)<<"("<<val.first<<","<<val.second<<")";
		#endif
		return *this;
	}
	template<typename T,template<typename,typename...>class Container,typename...Args>
	Cap1taLDebug& operator<<(const Container<T, Args...>& container){
		#ifdef DEBUGING
		buf<<"{";
		bool fst=0;
		for(const auto& val:container){
			if(!fst)	fst=true;
			else	buf<<",";
			(*this)<<val;	
		}
		buf<<"}";
		#endif
		return *this;
	}
	Cap1taLDebug& operator<<(const __int128& val){
		#ifdef DEBUGING
		buf<<int128ToString(val);
		#endif
		return *this;
	}
	template<typename T>
	Cap1taLDebug& operator<<(const T& val){
		#ifdef DEBUGING
		buf<<val;
		#endif
		return *this;
	}
	Cap1taLDebug& operator<<(ostream& (*manip)(ostream&)){
		#ifdef DEBUGING
		buf<<manip;
		#endif
		return *this;
	}
};
#ifndef DEBUGING
char Cap1taLDebug::fbuf[1<<21],*Cap1taLDebug::p1=nullptr,*Cap1taLDebug::p2=nullptr;
#endif
Cap1taLDebug cein(cout);
// Cap1taLDebug cein(cerr);
ostream& operator<<(ostream& os,__int128 val){
	os<<Cap1taLDebug::int128ToString(val);
	return os;
}
template<typename T>
class Stack : public stack<T>{
public:
	void clear(){
		while(!this->empty())	this->pop();
	}
	void popuntil(const function<bool(T)>& func){
		while(!this->empty() && !func(this->top()))	this->pop();
	}
};
/*

*/
int n,m,q;
string s;
bitset<10> a[100005];
vector<int> ans[260];
bool rev[10];
void solve(bool SPE){ 
	n=RIN,m=RIN,q=RIN;
	foru(i,0,n-1){
		s=RSIN;
		foru(j,1,m){
			a[j][i]=s[j-1]=='1';
		}
	}
	
	
	for(int i=0;i<(1<<n);i++){
		ans[i].resize(100005,0);
		foru(j,1,m){
			int cnt=0;
			foru(k,0,n-1){
				if(((i>>k)&1)!=a[j][k]){
					cnt++;
				}
			}
			ans[i][j]=min(cnt,1+n-cnt);
			ans[i][0]+=min(cnt,1+n-cnt);
		}
	}
	auto genAns=[&]()->int{
		int ret=INT_MAX;
		for(int i=0;i<(1<<n);i++){
			ret=min(ret,ans[i][0]+__builtin_popcount(i));
		}
		return ret;
	};
	
	printf("%d\n",genAns());
	
	foru(o,1,q){
		char opt=RCIN;
		if(opt=='P'){
			int x=RIN-1,y=RIN;
			a[y][x]=!a[y][x];
			for(int i=0;i<(1<<n);i++){
				int j=y;
				ans[i][0]-=ans[i][j];
				int cnt=0;
				foru(k,0,n-1){
					if(((i>>k)&1)!=(rev[k]^a[j][k])){
						cnt++;
					}
				}
				ans[i][j]=min(cnt,1+n-cnt);
				ans[i][0]+=min(cnt,1+n-cnt);
			}
		}else if(opt=='R'){
			int x=RIN-1;
			rev[x]^=1;
			for(int i=0;i<(1<<n);i++){
				if((i>>x)&1){
					swap(ans[i],ans[i^(1<<x)]);
				}
			}
		}else{
			int y=RIN;
			foru(i,0,n-1){
				a[y][i]=!a[y][i];
			}
			for(int i=0;i<(1<<n);i++){
				int j=y;
				ans[i][0]-=ans[i][j];
				int cnt=0;
				foru(k,0,n-1){
					if(((i>>k)&1)!=(rev[k]^a[j][k])){
						cnt++;
					}
				}
				ans[i][j]=min(cnt,1+n-cnt);
				ans[i][0]+=min(cnt,1+n-cnt);
			}
		}
		printf("%d\n",genAns());
		// break;
	}
	
	#ifdef DEBUGING
	if(SPE){
		
	}
	#endif
	return ;
}
/*
检查文件读写
检查多测清空
检查数组大小
*/
signed main()
{
	// #define RFILE
	// #define MULTITEST
	// #define TESTCASEID
	
	#ifdef RFILE
	freopen(".in","r",stdin);
	freopen(".out","w",stdout);
	#endif
	
	#ifdef MULTITEST
	int T=RIN;
	#else
	int T=1;
	#endif
	
	#ifdef TESTCASEID
	ID=RIN;
	#endif
	
	for(int i=1;i<=T;i++) solve(i==0);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 6252kb

input:

3 4 6
1010
1101
0010
R 2
P 3 1
K 2
P 2 1
K 4
P 3 4

output:

3
2
3
4
3
3
4

result:

ok 7 numbers

Test #2:

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

input:

3 4 100000
0100
0011
0011
R 3
K 1
R 2
K 4
R 3
K 2
P 1 1
K 1
R 1
P 1 4
K 4
K 1
K 4
R 3
K 2
K 2
R 1
K 1
K 4
P 3 2
P 2 1
K 1
R 1
P 3 1
R 3
K 3
P 3 2
P 1 3
K 1
R 1
P 1 1
R 1
P 2 1
R 3
P 3 1
R 2
K 2
R 1
R 1
R 3
P 1 3
R 3
K 3
R 2
R 1
P 3 4
K 1
K 1
P 1 4
R 3
K 1
P 1 2
R 1
K 3
P 2 2
R 1
P 1 1
K 4
R 2
P 3 4
...

output:

4
4
3
2
3
4
3
2
3
3
4
4
3
4
3
4
3
2
3
2
3
4
3
4
4
5
5
5
4
3
4
4
4
5
4
3
4
4
3
4
3
3
4
5
4
4
5
4
5
4
4
4
4
5
5
4
4
3
4
5
4
3
4
4
5
4
5
4
5
4
4
5
5
4
5
5
4
4
4
3
4
3
2
3
4
4
3
4
4
3
3
4
3
4
4
3
4
3
2
3
2
3
2
3
4
3
2
3
4
4
3
4
5
5
5
5
4
4
4
5
4
4
4
5
5
5
4
3
4
3
4
4
5
4
5
5
5
4
3
4
4
5
4
5
4
5
4
3
4
4
...

result:

ok 100001 numbers

Test #3:

score: 0
Accepted
time: 15ms
memory: 9436kb

input:

4 3 100000
110
110
010
000
K 2
K 3
K 2
R 4
P 3 3
K 3
K 2
R 4
R 2
R 1
P 3 2
R 3
K 1
K 1
R 1
K 3
P 1 3
R 2
K 2
K 3
R 3
P 4 1
K 2
P 1 1
R 3
R 1
R 3
K 3
K 1
K 3
R 3
R 1
K 1
P 2 2
P 2 3
K 2
K 3
K 3
K 3
K 3
P 2 2
R 3
R 4
R 1
P 4 1
P 2 2
K 1
K 1
R 3
K 2
R 4
K 2
R 1
R 4
R 4
K 1
P 4 2
R 3
K 3
R 2
R 1
K 1
K 1...

output:

4
3
4
5
5
5
5
4
4
5
4
3
4
4
4
4
4
5
4
5
5
4
5
4
5
4
3
4
5
4
3
2
3
4
4
5
4
5
4
5
4
5
5
4
5
4
5
4
5
5
5
5
4
5
6
5
4
5
5
4
5
4
5
4
3
4
5
5
4
3
4
5
5
5
4
5
4
5
4
4
4
3
4
5
4
3
4
4
4
3
4
4
4
5
4
4
3
4
4
5
4
5
4
5
4
5
4
4
5
4
5
5
4
3
2
3
4
5
4
4
4
5
4
3
4
4
4
3
4
3
4
4
3
3
4
4
3
2
3
2
3
3
3
4
3
4
5
4
5
5
...

result:

ok 100001 numbers

Test #4:

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

input:

1 1 10000
1
P 1 1
R 1
P 1 1
K 1
P 1 1
P 1 1
R 1
K 1
P 1 1
K 1
K 1
P 1 1
K 1
K 1
R 1
R 1
K 1
K 1
K 1
R 1
P 1 1
K 1
P 1 1
R 1
R 1
K 1
P 1 1
K 1
K 1
K 1
K 1
K 1
K 1
K 1
R 1
P 1 1
P 1 1
R 1
K 1
P 1 1
R 1
R 1
R 1
K 1
P 1 1
P 1 1
P 1 1
R 1
R 1
P 1 1
R 1
K 1
R 1
P 1 1
R 1
K 1
R 1
P 1 1
R 1
P 1 1
K 1
R 1
R ...

output:

1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
...

result:

ok 10001 numbers

Test #5:

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

input:

2 2 100000
11
01
K 1
R 1
K 2
R 1
K 1
P 2 2
K 2
R 2
P 2 1
K 2
R 1
R 1
K 1
K 1
R 2
P 1 2
P 2 2
K 2
R 2
K 1
R 2
P 2 1
R 1
K 2
P 1 1
P 1 1
P 1 1
P 2 2
K 1
R 2
P 2 2
P 2 2
P 1 2
P 2 1
R 2
P 2 2
P 2 1
K 2
K 2
P 2 2
P 2 1
R 1
R 1
K 2
K 2
P 2 1
R 1
P 1 2
R 2
P 1 1
R 2
R 1
P 2 1
P 1 1
K 1
K 2
R 1
P 2 1
R 1
K...

output:

2
2
2
2
1
1
2
1
2
2
1
1
1
1
1
2
2
2
2
1
1
1
1
2
1
1
1
1
1
2
1
2
1
2
1
2
2
1
2
1
2
2
1
2
1
2
2
1
1
2
2
2
1
1
2
1
1
1
1
2
1
0
1
2
1
2
1
0
1
2
1
2
1
2
2
2
2
2
2
1
2
1
1
1
1
2
1
2
1
1
1
2
2
2
1
1
1
2
2
1
1
1
2
2
1
2
1
1
2
1
2
1
1
1
0
1
1
1
1
2
2
1
2
1
2
2
1
0
1
2
1
2
1
2
1
0
1
0
1
2
1
2
1
0
1
1
1
1
1
1
...

result:

ok 100001 numbers

Test #6:

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

input:

8 100 100
1011100111011111110000100100100101000100111100011000001000101011001101001011010100110010110100010110
1001100100100101011101110000100001100001010100111011100111101000110011000010010001000010001101000001
0111000100001001100001111000111110100111100000010111100110110010110100000010011011100000...

output:

302
303
304
305
305
304
305
304
303
302
303
302
301
300
301
302
301
302
301
300
299
298
299
300
299
298
299
300
299
300
301
302
302
301
300
299
300
301
302
301
302
303
302
303
302
301
301
300
299
298
297
298
299
298
298
297
298
297
296
295
296
295
294
294
295
296
295
296
297
298
299
299
300
301
302
...

result:

ok 101 numbers

Test #7:

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

input:

7 100 100
0110101100110100101101011011110110011011111111001001111111111110011000000110010000110001001100000000
1011011110010100111101010001101000100110011111110111000110111110000101000010001001110110101101100101
0010010101110110010111010010000111000101110101111110110010110011100001101001010001101011...

output:

275
275
275
274
273
274
274
275
274
274
273
274
275
275
275
275
275
275
274
273
274
273
272
271
270
269
270
271
272
271
272
271
270
269
270
269
268
267
268
269
270
271
270
269
268
269
270
269
270
271
272
273
274
273
272
271
270
269
268
267
268
267
268
267
268
267
268
269
270
269
268
269
268
267
266
...

result:

ok 101 numbers

Test #8:

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

input:

6 100 100
1010111111000000010001111010011000101111101101010010001010100000000100001011010100001001101110110111
1100110100111000100000011001011111001010000011011011000011010100101110101110110000101001010110001011
0101000000000111000100010011100001001010011001010100110111010111111101001101010011101111...

output:

224
225
226
225
224
224
225
226
225
226
225
226
225
226
225
226
225
226
226
226
226
226
225
226
227
227
226
227
227
228
227
228
229
228
227
228
229
229
228
228
227
228
227
228
227
226
225
224
223
223
223
224
225
225
224
225
225
225
224
225
226
227
226
225
226
226
227
226
226
227
226
226
227
228
229
...

result:

ok 101 numbers

Test #9:

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

input:

1 100 100000
0011100001111101100101010100101011111101000011001110000100000111100011000010010011011000010011100100
K 90
R 1
R 1
R 1
K 51
K 38
K 47
R 1
R 1
P 1 96
K 56
K 19
K 20
R 1
K 52
P 1 90
P 1 66
P 1 35
R 1
P 1 57
R 1
R 1
P 1 56
R 1
K 29
K 96
R 1
R 1
R 1
R 1
K 40
K 68
P 1 9
P 1 92
P 1 78
R 1
K 30...

output:

46
45
46
45
46
45
44
45
44
45
46
45
46
45
44
45
46
47
46
47
48
47
48
49
48
47
46
47
46
47
46
45
46
47
48
47
48
49
48
49
50
50
49
50
50
50
50
50
49
50
49
50
49
50
50
50
49
50
50
49
48
49
50
49
48
49
48
49
48
47
48
49
48
49
48
47
48
47
46
47
46
45
46
45
46
45
46
47
48
47
46
47
48
47
48
47
46
47
48
49
...

result:

ok 100001 numbers

Test #10:

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

input:

2 100 100000
1010001101110111101111110111011110011110111110111110111010000110011111101100111001010011110001101110
0110010111101101111010000001001011101100110101000101100001011111100110010110010000110011001011000110
K 50
R 1
K 22
R 2
P 1 19
K 7
R 2
R 1
P 2 95
P 1 1
R 2
K 96
R 1
P 2 34
K 49
R 2
P 2 21...

output:

66
66
65
66
67
67
68
67
68
69
70
71
70
69
69
69
70
69
70
70
69
69
70
71
71
71
71
71
70
70
69
70
71
71
71
70
69
68
68
69
68
69
68
69
69
70
69
69
69
68
68
69
70
70
71
72
71
71
72
71
72
71
70
70
69
68
67
67
68
68
68
69
68
68
67
67
68
69
70
70
69
68
68
69
70
69
70
70
71
72
72
71
71
72
72
71
70
71
71
72
...

result:

ok 100001 numbers

Test #11:

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

input:

8 100 100000
1011011101111011000001001110011100111000101001100010001110010100001010010110111001111010111100111100
0111101001110111101001010011011011001010100100111111110111110001010010011111011010010100001110111110
1111110111110010110110111110101111001001000011000000000011111011000100001011011101110...

output:

306
307
306
305
305
306
305
304
303
302
303
303
302
303
302
303
303
304
303
302
301
301
300
301
301
301
302
303
304
303
304
305
306
306
307
306
307
306
307
308
307
306
305
306
305
304
303
303
302
303
303
302
301
302
302
303
302
301
302
301
302
301
302
301
301
302
303
302
303
302
302
303
302
302
302
...

result:

ok 100001 numbers

Test #12:

score: 0
Accepted
time: 1053ms
memory: 104620kb

input:

8 100000 100000
01101011010110010101001010111010111001101100100101001101001011000111110101011010010011100000001001011101010011110001111100000001010100011000010001000101100100101010001011111111111101101111110100010010100010100010110101101010000011010100100100100111110001000111100101110100111001100110...

output:

322545
322546
322545
322545
322544
322543
322544
322543
322543
322542
322542
322543
322542
322541
322541
322541
322540
322541
322542
322541
322541
322542
322542
322543
322544
322545
322544
322543
322542
322542
322541
322540
322541
322542
322543
322544
322543
322544
322544
322543
322542
322543
322542...

result:

ok 100001 numbers

Test #13:

score: 0
Accepted
time: 1082ms
memory: 104360kb

input:

8 99999 100000
001011011110001110100010100000010011010011000111100101101011100101001011000010000001010001110101110101010011100110011111100001010000001010110010010000010100100110111000100100111011000010101111101110000100000111110111101111000001000000010111000111111010011101110001010111010010100010110...

output:

326724
326724
326724
326723
326722
326721
326720
326721
326722
326721
326721
326722
326723
326722
326722
326722
326721
326720
326721
326722
326722
326721
326720
326719
326720
326719
326720
326719
326719
326720
326720
326720
326719
326720
326721
326722
326721
326721
326720
326719
326718
326717
326718...

result:

ok 100001 numbers

Test #14:

score: 0
Accepted
time: 341ms
memory: 103436kb

input:

8 1 100000
1
0
1
1
1
0
0
0
K 1
R 2
R 3
K 1
P 7 1
K 1
R 6
R 7
R 8
K 1
K 1
K 1
K 1
P 1 1
P 1 1
P 8 1
K 1
K 1
P 8 1
P 1 1
K 1
K 1
R 2
R 4
K 1
K 1
P 7 1
P 8 1
P 3 1
R 5
P 5 1
K 1
R 3
P 3 1
R 6
R 5
R 3
K 1
P 5 1
P 7 1
P 2 1
R 6
R 6
P 4 1
R 5
R 7
R 4
R 4
K 1
R 7
P 3 1
K 1
K 1
K 1
R 6
P 8 1
P 5 1
K 1
R 8
R...

output:

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

result:

ok 100001 numbers

Test #15:

score: 0
Accepted
time: 38ms
memory: 53112kb

input:

7 5 33232
11010
00110
00111
01000
00010
11011
11110
R 2
P 7 1
R 6
K 2
P 4 5
P 1 5
K 3
P 7 5
P 2 5
K 1
K 4
P 6 1
P 3 4
P 6 4
R 4
K 5
P 6 1
K 1
R 2
R 6
P 7 4
R 1
P 6 5
K 1
R 1
R 3
R 5
K 1
R 1
K 1
P 3 4
K 3
R 5
P 5 5
P 4 2
K 5
R 1
P 2 4
P 1 5
K 5
R 5
P 4 4
R 2
P 2 2
K 2
P 6 5
R 4
P 2 1
P 7 1
R 6
R 3
P ...

output:

14
13
14
13
12
13
12
11
12
13
14
13
14
15
14
13
14
13
12
11
12
13
12
11
12
13
12
13
14
13
14
13
12
13
12
13
12
11
10
9
10
9
10
9
10
11
12
13
14
13
12
11
10
11
12
11
12
11
12
13
14
13
14
13
14
13
12
13
14
13
14
13
14
13
12
13
14
13
14
13
12
13
14
13
12
11
12
13
12
11
12
11
12
13
12
11
12
11
12
11
12
...

result:

ok 33233 numbers

Test #16:

score: 0
Accepted
time: 1341ms
memory: 104624kb

input:

8 100000 100000
10110100101110110111010110010001100100101000000001011101000011100011010100110000110111100001100100000000111011100000010010011101100101101010110000001001110101100000000101101100110110100100001101010001001100110011001011010010110101111001001000010111110000011111101100101101110001001111...

output:

322504
322504
322504
322503
322503
322502
322501
322500
322499
322498
322499
322500
322499
322500
322500
322501
322501
322502
322502
322501
322502
322503
322504
322503
322504
322505
322506
322507
322508
322507
322506
322507
322508
322508
322508
322509
322510
322509
322510
322511
322510
322509
322510...

result:

ok 100001 numbers

Test #17:

score: 0
Accepted
time: 362ms
memory: 104396kb

input:

8 100000 100000
00011111100111101010010101001001000110100001011011100111001010100111001001111100101010011111010000100101110001101100011101000001011101111100110110010101001011100000000110101100010110010111000001010111000001111111000100011001100111111100011000110011110100101101000100100010100110111001...

output:

322504
322503
322502
322503
322504
322503
322504
322505
322504
322503
322504
322505
322504
322503
322502
322501
322502
322501
322502
322503
322502
322501
322502
322501
322502
322501
322502
322501
322502
322503
322502
322501
322502
322503
322504
322503
322502
322503
322502
322503
322502
322503
322504...

result:

ok 100001 numbers

Test #18:

score: -100
Time Limit Exceeded

input:

8 100000 100000
00001011001110110000101101111011101000000100000001101011001110000111111000000101100110110001100101101011100101000101101001001011101111000110010100111011100011101011101001100100100110101010100110011011101111001011101111111110011000001111010110001111010100110101100001111100101101110110...

output:

322528
322527
322527
322527
322526
322526
322526
322525
322524
322523
322522
322521
322520
322521
322521
322520
322519
322519
322519
322518
322519
322520
322520
322519
322518
322519
322519
322518
322517
322518
322519
322518
322518
322517
322517
322516
322517
322518
322517
322518
322517
322516
322515...

result: