QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#846285#9988. 挑战大模型CrysflyAC ✓2829ms511300kbC++142.0kb2025-01-07 02:43:002025-01-07 02:46:35

Judging History

你现在查看的是测评时间为 2025-01-07 02:46:35 的历史记录

  • [2025-01-07 02:48:40]
  • 管理员手动重测该提交记录
  • 测评结果:AC
  • 用时:2861ms
  • 内存:510228kb
  • [2025-01-07 02:46:35]
  • 管理员手动重测该提交记录
  • 测评结果:0
  • 用时:2829ms
  • 内存:511300kb
  • [2025-01-07 02:43:01]
  • 评测
  • 测评结果:0
  • 用时:1878ms
  • 内存:479872kb
  • [2025-01-07 02:43:00]
  • 提交

answer

#include<bits/stdc++.h>
#define For(i,x,y) for (int i=(x);i<=(y);i++)
#define FOR(i,x,y) for (int i=(x);i<(y);i++)
#define Dow(i,x,y) for (int i=(x);i>=(y);i--)
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define ep emplace_back
#define siz(x) ((int)x.size())
#define all(x) x.begin(),x.end()
#define fil(a,b) memset(a,b,sizeof a)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pa;
typedef pair<ll,ll> PA;
typedef vector<int> poly;
inline ll read(){
	ll x=0,f=1;char c=getchar();
	while ((c<'0'||c>'9')&&(c!='-')) c=getchar();
	if (c=='-') f=-1,c=getchar();
	while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
	return x*f;
}

const int N = 510;
int n,m,ans[N],a[N],l[N],r[N],top,stk[N];
char s1[N][N],s2[N][N];
short lcp[N][N][N],mn[N][N][N];

inline bool check(int lx,int rx,int ly,int ry){
	if (lx>rx||ly>ry) return 1;
	if (ly+mn[ly][lx][rx]-1>=ry) return 1;
	return 0;
}

int main(){
	n=read(),m=read();
	For(i,1,n) scanf("%s",s1[i]+1);
	For(i,1,n) scanf("%s",s2[i]+1);
	For(i,1,n){
		Dow(j,m,1) Dow(k,m,1){
			if (s1[i][j]==s2[i][k]) lcp[i][j][k]=lcp[i][j+1][k+1]+1;
		}
	}
	For(j,1,m){
		For(l,1,n){
			mn[j][l][l]=lcp[l][j][j];
			For(r,l+1,n){
				mn[j][l][r]=min(mn[j][l][r-1],lcp[r][j][j]);
			}
		}
	} 
	For(i,1,m-1) ans[i]=-1;
	For(j,1,m) For(k,j+1,m){
		For(i,1,n) a[i]=lcp[i][k][j];
		//For(i,1,n) printf("%d ",a[i]);
		//puts("");
		top=0;
		stk[0]=0;
		For(i,1,n){
			while (top&&a[i]<=a[stk[top]]) --top;
			l[i]=stk[top]+1;
			stk[++top]=i;
		}
		top=0;
		stk[0]=n+1;
		Dow(i,n,1){
			while (top&&a[i]<=a[stk[top]]) --top;
			r[i]=stk[top]-1;
			stk[++top]=i;
		}
		For(i,1,n){
			int L=l[i],R=r[i];
			if (!check(1,L-1,1,m)) continue;
			if (!check(R+1,n,1,m)) continue;
			if (!check(L,R,1,j-1)) continue;
			if (!check(L,R,k+a[i],m)) continue;
			if (!check(L,R,j+a[i],k-1)) continue;
			if (a[i]==0) continue;
			ans[k-j]=max(ans[k-j],(R-L+1)*a[i]);
		}
	}
	For(i,1,m-1) printf("%d ",ans[i]);
}

详细

Test #1:

score: 100
Accepted
time: 1839ms
memory: 488460kb

input:

484 484
1001110011010001101100110111010110011011110110101001010000101111010111001100111011010010000011110111011101000101000011011011100111001111111100100101101000111000100000011100110011101000101000010100101010011110000111101101100110000110111100100001111001110111010001000111101001111111001000001001...

output:

-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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 483 numbers

Test #2:

score: 0
Accepted
time: 1804ms
memory: 485980kb

input:

484 484
0111111010101000011110010000001010001100101001010101100001011110110001011111100110111111010100111010111011101010001100101101110111101000100001100000110000000011000100100100011001010110110101101110100010010100001010110100110001001000101101100011000011000011111001011001110111111100001110001111...

output:

-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 9156 -1 -1 -1 -1 -1 -...

result:

ok 483 numbers

Test #3:

score: 0
Accepted
time: 1855ms
memory: 490996kb

input:

486 486
1101001010110010100000111110001110010111110111000010001111111100101110011000101100100100011100110000001001000110111001000111100001001100010001100000100111011111010100101110100100010001010101100110111100110110111111010110000110101011001010001110100111011000000100110010000110100101000101111001...

output:

-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 4437 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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 485 numbers

Test #4:

score: 0
Accepted
time: 1850ms
memory: 496504kb

input:

491 491
1110110101101001101110001001100111111101011110000111101101010001010100000011010001101011011001101011010011011011101110010110100001110110111011111100101100111111000100111011100110110100101010001011000001101111100110010110010101001001111000111110011001000010111011001111001100101101010011111010...

output:

-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 16940 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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 490 numbers

Test #5:

score: 0
Accepted
time: 1774ms
memory: 482568kb

input:

481 481
0000000000001000000100000000010010000001110000000000000001010000001000000000000100000001001000000000000000000000000000000000000001000000000000001000000000000000000000011000001000001000000000000000000100000000000000110000000010010000000000000000000000001000010000100000000000000000000000001100...

output:

-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 880...

result:

ok 480 numbers

Test #6:

score: 0
Accepted
time: 1993ms
memory: 511300kb

input:

499 499
0100010001010000000010000000000001000000000000000000000000000000000110000000000000000000000000000000000000000010001000000000010000000000000000000000000000000000000000000000000000001000000000000000000000000000100100000000000100001000000000000000001000001100000000000000000000000000000010001010...

output:

-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 16440 -1 -1 -1 -1 -1 -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 498 numbers

Test #7:

score: 0
Accepted
time: 1146ms
memory: 491972kb

input:

487 487
0101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101...

output:

-1 236195 -1 235221 -1 234247 -1 233273 -1 232299 -1 231325 -1 230351 -1 229377 -1 228403 -1 227429 -1 226455 -1 225481 -1 224507 -1 223533 -1 222559 -1 221585 -1 220611 -1 219637 -1 218663 -1 217689 -1 216715 -1 215741 -1 214767 -1 213793 -1 212819 -1 211845 -1 210871 -1 209897 -1 208923 -1 207949 ...

result:

ok 486 numbers

Test #8:

score: 0
Accepted
time: 1936ms
memory: 499404kb

input:

491 491
1001000011010011000100110001001110001000110010000011110000101111100000010000010101000100110100000100100100000110110000000010101011110110001000100001011001101001011000000011101110000010010001100000000100001000000000100000001001001110001010110000011001110000000100000010001100011111100011010110...

output:

-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 544...

result:

ok 490 numbers

Test #9:

score: 0
Accepted
time: 1901ms
memory: 495180kb

input:

488 488
1110100001001100011000110100010010110011000001110101001010101011110000001010000101101011110100000101010001100001010000000111001100010100101010100001011101010001111010101111110011100101111000000001100110111001100001000011001110111011011011010100111000111100000001111101111110010010110011101010...

output:

-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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 487 numbers

Test #10:

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

input:

20 20
10001100100101101001
11000010110010000111
11010111110000100001
11011011100010111000
10111001001011111001
11101101101110000011
10101011000111000010
01111110011110110100
10001000000011000100
01101111010110100100
10001010010010001101
00010100000010001101
11101000101001100100
00011110001110100000
...

output:

4 -1 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 

result:

ok 19 numbers

Test #11:

score: 0
Accepted
time: 1862ms
memory: 501000kb

input:

492 492
1101000011111110001000010100011010001110100101110101001000111101111111000001001101100111011000100100101111100000001101111110011111010110101010101100100000110010001101000000101110011100110000010011001010111011100001101100010100011001111101000110101000110101010101101000010010101110111010110011...

output:

-1 225624 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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 491 numbers

Test #12:

score: 0
Accepted
time: 1332ms
memory: 507284kb

input:

497 497
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111001010010001111101111110111111111011101111111111111110111011111011111110111111111101111111110110101...

output:

-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 10812 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...

result:

ok 496 numbers

Test #13:

score: 0
Accepted
time: 1127ms
memory: 494668kb

input:

489 489
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 51345 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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 488 numbers

Test #14:

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

input:

7 15
001010011101000
110001111110110
010101100011111
100000100011010
110100100101000
110011011010101
010001011011111

010011101000110
001111110110010
101100011111001
000100011010010
100100101001110
110011011010101
010001011011111

output:

-1 -1 55 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 

result:

ok 14 numbers

Test #15:

score: 0
Accepted
time: 29ms
memory: 262884kb

input:

10 500
10001110001110011101010001101010000111110101101111000100011110110101000010000110000110111000111101101110011000000011010110101001010101000110110000101000011001100110011000001101110010001101011011110001001111100100110000011110000100000100010001010010011011011000000110111101000010111010100100111...

output:

-1 -1 5 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 4 -1 5 -1 -1 4 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 5 5 4 4 -1 -1 -1 -1 -1 -1 -1 4 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 4 -1 -1 -1 -1 -1 -1 -1 4 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 5 -1 -1 -1 -1 -1 -1 -1 12 ...

result:

ok 499 numbers

Test #16:

score: 0
Accepted
time: 313ms
memory: 308008kb

input:

100 500
0000001101101100110110110010110110010110000010001001010001010010011000111110011111000100010111100000111010011101011101100110000010100001100000101011010001010011101111001001000001100111110101010101001101101100000111001011110100000100110001001110011110010000011001010100000110101011100100111010...

output:

-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 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 -...

result:

ok 499 numbers

Test #17:

score: 0
Accepted
time: 56ms
memory: 267888kb

input:

20 500
11010110010011101110111111001100001011110111001001010101001101101111000010100000101010110110001010110111101011001000000011111011000000110111000000000001111110011011010100000000110110110001001100011101100110101111100100110000011001110101011100011011000001100000001011110010011100100110001001001...

output:

2 -1 -1 -1 4 -1 5 6 6 3 -1 -1 -1 6 -1 -1 -1 3 9 6 -1 2 -1 -1 -1 -1 6 4 -1 4 -1 -1 -1 2 -1 -1 4 -1 -1 6 -1 -1 6 4 -1 -1 4 -1 6 8 3 -1 5 5 6 4 -1 6 -1 -1 8 9 -1 -1 2 -1 3 7 6 -1 -1 -1 -1 -1 -1 4 -1 -1 4 -1 -1 8 -1 -1 4 -1 6 7 -1 -1 -1 2 -1 -1 -1 -1 3 -1 -1 6 -1 6 -1 10 -1 -1 -1 -1 2 -1 -1 -1 -1 2 -1 1...

result:

ok 499 numbers

Test #18:

score: 0
Accepted
time: 37ms
memory: 57556kb

input:

500 50
11000001101010001011110111010001101010100001001100
00101111011001101000000110101001001111010001111011
01100000010000011101111100010100010110111111101011
10011011100101010111010001011110011101111111010010
11111101111001110101111011110011001101111011100101
11001110111011100111001110100111011110...

output:

-1 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 8 8 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 

result:

ok 49 numbers

Test #19:

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

input:

500 10
0111000111
1010001011
0001011001
1001011000
1000010011
1111000001
1110011011
0011000001
1101001001
1001010110
0100010010
1111010110
0100001010
0001000011
0001000011
0101001111
0110010011
0100001000
1000100111
0111110001
1001001101
0100110001
1010100100
0000100100
0000010010
1110101101
1011110...

output:

282 -1 -1 -1 -1 -1 -1 -1 -1 

result:

ok 9 numbers

Test #20:

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

input:

500 100
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

5824 5720 5616 5512 5408 5304 5200 5096 4992 4888 4784 4680 4576 4472 4368 4264 4160 4056 3952 3848 3744 3640 3555 3484 3417 3350 3283 3294 3416 3480 3480 3480 3480 3480 3480 3480 3480 3480 3480 3395 3395 3298 3201 3108 3024 2982 3144 3406 3668 3668 3406 3264 2992 2720 2627 2556 2652 3094 3224 3224 ...

result:

ok 99 numbers

Test #21:

score: 0
Accepted
time: 2829ms
memory: 509432kb

input:

500 500
0001100000101110000000011000001011100000000110000010111000000001100000101110000000011000001011100000000110000010111000000001100000101110000000011000001011100000000110000010111000000001100000101110000000011000001011100000000110000010111000000001100000101110000000011000001011100000000110000010...

output:

1497 1992 1491 2976 1485 1976 1479 2952 1473 1960 1467 2928 1461 1944 1940 2904 1449 2410 1443 4320 1437 1912 1431 2856 1425 1896 1419 2832 1413 2350 1407 2808 1401 1864 1395 2784 1389 1848 1383 4600 1377 1832 1371 2736 1820 1816 1359 2712 1353 1800 1347 2688 1341 2230 1335 2664 1329 1768 1323 3960 ...

result:

ok 499 numbers

Test #22:

score: 0
Accepted
time: 2381ms
memory: 509940kb

input:

500 500
1110111011101110111011101110111011101110111011101110111011101110111011101110111011101110111011101110111011101110111011101110111011101110111011101110111011101110111011101110111011101110111011101110111011101110111011101110111011101110111011101110111011101110111011101110111011101110111011101110...

output:

2994 4482 3976 6944 4950 6422 2958 6888 3928 7350 2934 14640 2922 4374 6790 6776 2898 6266 2886 18720 3832 4302 2862 14280 4750 4266 3784 6608 2826 13630 2814 6552 3736 4194 4650 13920 2778 4158 3688 17940 2754 5954 2742 6384 6370 4086 2718 13560 2706 6750 3592 6272 2682 5798 4450 6216 3544 3978 264...

result:

ok 499 numbers

Test #23:

score: -100
Time Limit Exceeded

input:

500 500
0010000100110111000110010000100110111000110010000100110111000110010000100110111000110010000100110111000110010000100110111000110010000100110111000110010000100110111000110010000100110111000110010000100110111000110010000100110111000110010000100110111000110010000100110111000110010000100110111000...

output:

998 996 994 992 990 988 986 984 982 980 978 976 974 972 970 968 966 964 962 960 1437 956 954 952 950 948 946 944 942 940 938 936 934 932 930 1392 926 924 922 920 918 1374 914 912 910 908 906 1356 902 900 898 896 894 892 1335 888 1329 884 882 880 878 876 1311 1308 870 868 866 864 862 860 858 1284 854...

result: