3900 | 2023-03-03 19:45:11 | kohumark | Mágikus táblázat | cpp17 | Runtime error 14/100 | 600ms | 524732 KiB |
#include <iostream>
#include <vector>
using namespace std;
int main(){
int n,m; cin >> n >> m;
int a[n]; int b[m];
for(int i=0; i<n; i++) cin >> a[i];
for(int i=0; i<m; i++) cin >> b[i];
int table[n][m];
for(int i=0; i<n; i++) for(int j=0; j<m; j++){
if(a[i]-b[j]>=0){
table[i][j]=1;
if(i>0) table[i][j]=table[i-1][j]+1;
}
else table[i][j]=0;
}
int y=0;
for(int i=n-1; i>-1; i--) for(int j=m-1; j>-1; j--){
int x=table[i][j];
if(table[i][j]>0) for(int k=j; k>-1; k--){
if(table[i][k]==0) break;
x=min(x,table[i][k]);
y=max(x*(j-k+1),y);
}
}
cout << y;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 2000 KiB | ||||
2 | Runtime error | 160ms | 524732 KiB | ||||
subtask2 | 14/14 | ||||||
3 | Accepted | 3ms | 2388 KiB | ||||
4 | Accepted | 3ms | 2512 KiB | ||||
5 | Accepted | 4ms | 2696 KiB | ||||
6 | Accepted | 3ms | 2760 KiB | ||||
7 | Accepted | 3ms | 2892 KiB | ||||
8 | Accepted | 3ms | 3092 KiB | ||||
subtask3 | 0/27 | ||||||
9 | Time limit exceeded | 600ms | 14112 KiB | ||||
10 | Time limit exceeded | 555ms | 14140 KiB | ||||
11 | Time limit exceeded | 569ms | 14420 KiB | ||||
12 | Accepted | 93ms | 26360 KiB | ||||
13 | Accepted | 8ms | 12252 KiB | ||||
14 | Accepted | 224ms | 12204 KiB | ||||
15 | Time limit exceeded | 570ms | 11904 KiB | ||||
16 | Time limit exceeded | 552ms | 19064 KiB | ||||
17 | Accepted | 19ms | 33680 KiB | ||||
subtask4 | 0/21 | ||||||
18 | Runtime error | 208ms | 522772 KiB | ||||
19 | Runtime error | 250ms | 522540 KiB | ||||
20 | Runtime error | 206ms | 522500 KiB | ||||
21 | Runtime error | 203ms | 522480 KiB | ||||
22 | Runtime error | 202ms | 522444 KiB | ||||
23 | Runtime error | 241ms | 522208 KiB | ||||
24 | Accepted | 19ms | 34452 KiB | ||||
subtask5 | 0/38 | ||||||
25 | Runtime error | 291ms | 522048 KiB | ||||
26 | Runtime error | 291ms | 522044 KiB | ||||
27 | Runtime error | 289ms | 521816 KiB | ||||
28 | Runtime error | 248ms | 521812 KiB | ||||
29 | Runtime error | 244ms | 521796 KiB | ||||
30 | Runtime error | 287ms | 521788 KiB | ||||
31 | Runtime error | 244ms | 521736 KiB | ||||
32 | Runtime error | 257ms | 521744 KiB | ||||
33 | Runtime error | 244ms | 521736 KiB | ||||
34 | Runtime error | 246ms | 521732 KiB | ||||
35 | Runtime error | 202ms | 521716 KiB | ||||
36 | Runtime error | 291ms | 521716 KiB | ||||
37 | Runtime error | 259ms | 521712 KiB | ||||
38 | Runtime error | 248ms | 521712 KiB | ||||
39 | Runtime error | 246ms | 521684 KiB | ||||
40 | Runtime error | 241ms | 521684 KiB | ||||
41 | Runtime error | 228ms | 521704 KiB | ||||
42 | Runtime error | 244ms | 521720 KiB | ||||
43 | Runtime error | 243ms | 521708 KiB | ||||
44 | Runtime error | 250ms | 521708 KiB |