QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#846428 | #9988. 挑战大模型 | zzafanti | AC ✓ | 2009ms | 258556kb | C++23 | 4.7kb | 2025-01-07 08:21:12 | 2025-01-07 08:21:19 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N=505;
int n,m,a[N][N],b[N][N];
bool vis[N];
int L[N][N],R[N][N],rec_del[N],fa[N],sz[N];
short LCP[N][N][N];
vector<int> rec[N],del[N];
int get(int x){ return fa[x]==x?x:fa[x]=get(fa[x]); }
int main(){
//freopen("in.in","r",stdin);
//cerr<<(sizeof(LCP)/1024.0/1024);
cin.tie(0),cout.tie(0)->sync_with_stdio(false);
cin>>n>>m;
for(int i=1; i<=n; i++){
for(int j=1; j<=m; j++){
char c;
cin>>c;
a[i][j]=(c=='1');
}
}
for(int i=1; i<=n; i++){
for(int j=1; j<=m; j++){
char c;
cin>>c;
b[i][j]=(c=='1');
}
}
for(int i=1; i<=n; i++){
for(int j=m; j>0; j--){
for(int k=m; k>0; k--){
if(a[i][j]==b[i][k]){
LCP[i][j][k]=LCP[i][j+1][k+1]+1;
}
}
}
}
auto lcp=[&](int i,int x,int y){
return LCP[i][x][y];
};
int Low_b=0;
for(int i=1; i<=n; i++){
int flag=0;
for(int j=1; j<=m; j++){
if(a[i][j]!=b[i][j]){
flag=1;
break;
}
}
if(flag){
break;
}
Low_b=i;
}
int Up_b=n+1;
for(int i=n; i>0; i--){
int flag=0;
for(int j=1; j<=m; j++){
if(a[i][j]!=b[i][j]){
flag=1;
break;
}
}
if(flag){
break;
}
Up_b=i;
}
Up_b--;
Low_b++;
for(int d=1; d<m; d++){
int ans=-1;
for(int i=1; i<=n; i++){
int cnt=m+1;
for(int j=m; j>0; j--){
if(a[i][j]!=b[i][j]) break;
cnt=j;
}
cnt--;
int cc=0;
for(int j=1; j<=m; j++){
if(a[i][j]!=b[i][j]) break;
cc=j;
}
cc++;
int lst=0;
for(int j=1; j<=m; j++){
L[i][j]=lst+d;
if(a[i][j]!=b[i][j]){
lst=j;
}
if(j<=d||j-d>cc){
L[i][j]=m+1,R[i][j]=0;
continue;
}
L[i][j]=max(L[i][j],j);
L[i][j]=max(L[i][j],cnt);
R[i][j]=j+lcp(i,j,j-d)-1;
}
//cerr<<cc<<endl;
/*
for(int j=1; j<=m; j++){
cerr<<"at "<<d<<' '<<i<<' '<<j<<' '<<L[i][j]<<' '<<R[i][j]<<endl;
}*/
}
//cerr<<endl;
int sum=0;
for(int l=1; l<=m; l++){
if(Low_b<=Up_b){
int nowL=0,nowR=m;
for(int i=1; i<=n; i++){
if(i>=Low_b&&i<=Up_b){
nowL=max(nowL,L[i][l]);
nowR=min(nowR,R[i][l]);
}
}
for(int i=1; i<=n; i++){
vis[i]=0;
if(L[i][l]>R[i][l]) continue;
rec[L[i][l]].emplace_back(i);
del[R[i][l]+1].emplace_back(i);
}
for(int r=l; r<=m; r++){
for(auto p:rec[r]){
vis[p]=1;
}
for(auto p:del[r]){
vis[p]=0;
}
rec[r].clear();
del[r].clear();
if(nowL<=r&&r<=nowR){
//cerr<<nowL<<' '<<nowR<<' '<<Low_b<<' '<<Up_b<<endl;
//for(int i=Low_b; i<=Up_b; i++){
// assert(vis[i]);
//}
int cc0=0;
for(int i=Low_b-1; i>0; i--){
if(vis[i]) cc0++;
else break;
}
int cc1=0;
for(int i=Up_b+1; i<=n;i++){
if(vis[i]) cc1++;
else break;
}
/*
//cerr<<Up_b<<' '<<Low_b<<' '<<cc0<<' '<<cc1<<endl;
cerr<<"at "<<d<<' '<<l<<' '<<r-l+1<<' '<<Low_b<<' '<<Up_b<<' '<<Up_b-Low_b+1+cc0+cc1<<endl;
for(int i=1; i<=n; i++){
cerr<<vis[i];
}
cerr<<endl;
assert(vis[Low_b]);*/
ans=max(ans,(r-l+1)*(Up_b-Low_b+1+cc0+cc1));
}
}
del[n+1].clear();
}
else{
//cerr<<"OK";
for(int i=1; i<=n; i++){
fa[i]=i;
sz[i]=1;
vis[i]=0;
if(L[i][l]>R[i][l]) continue;
//assert(L[i][l]==l);
rec[R[i][l]].emplace_back(i);
}
int now=0;
auto merge=[&](int x,int y)->void{
if(vis[x]+vis[y]!=2) return ;
if(get(x)==get(y)) return ;
sz[get(x)]+=sz[get(y)];
fa[get(y)]=get(x);
};
for(int r=m; r>=l; r--){
for(auto p:rec[r]){
vis[p]=1;
if(p>1) merge(p,p-1);
if(p<n) merge(p,p+1);
now=max(now,sz[get(p)]);
}
rec[r].clear();
ans=max(ans,now*(r-l+1));
}
}
}
if(ans==0) ans=-1;
cout<<ans<<' ';
//cerr<<d<<' '<<sum<<endl;
}
cout<<'\n';
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1368ms
memory: 242200kb
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: 1606ms
memory: 242676kb
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: 1790ms
memory: 243924kb
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: 1494ms
memory: 248632kb
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: 1835ms
memory: 240512kb
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: 1695ms
memory: 257312kb
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: 1642ms
memory: 244884kb
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: 1431ms
memory: 249068kb
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: 1453ms
memory: 246436kb
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: 2ms
memory: 8236kb
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: 723ms
memory: 249728kb
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: 1367ms
memory: 255580kb
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: 1232ms
memory: 248376kb
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: 1ms
memory: 7800kb
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: 115ms
memory: 12824kb
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: 340ms
memory: 57872kb
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: 136ms
memory: 17872kb
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: 14ms
memory: 34652kb
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: 3ms
memory: 14984kb
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: 53ms
memory: 60020kb
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: 2009ms
memory: 258556kb
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: 1518ms
memory: 256476kb
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: 0
Accepted
time: 1947ms
memory: 257896kb
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:
ok 499 numbers
Test #24:
score: 0
Accepted
time: 1ms
memory: 5680kb
input:
1 5 01000 10101
output:
-1 -1 -1 -1
result:
ok 4 number(s): "-1 -1 -1 -1"
Test #25:
score: 0
Accepted
time: 1ms
memory: 7716kb
input:
5 5 00000 00001 10000 10100 10000 00000 00011 10000 10000 10000
output:
10 -1 -1 -1
result:
ok 4 number(s): "10 -1 -1 -1"