39002023-03-03 19:45:11kohumarkMágikus táblázatcpp17Runtime error 14/100600ms524732 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;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms2000 KiB
2Runtime error160ms524732 KiB
subtask214/14
3Accepted3ms2388 KiB
4Accepted3ms2512 KiB
5Accepted4ms2696 KiB
6Accepted3ms2760 KiB
7Accepted3ms2892 KiB
8Accepted3ms3092 KiB
subtask30/27
9Time limit exceeded600ms14112 KiB
10Time limit exceeded555ms14140 KiB
11Time limit exceeded569ms14420 KiB
12Accepted93ms26360 KiB
13Accepted8ms12252 KiB
14Accepted224ms12204 KiB
15Time limit exceeded570ms11904 KiB
16Time limit exceeded552ms19064 KiB
17Accepted19ms33680 KiB
subtask40/21
18Runtime error208ms522772 KiB
19Runtime error250ms522540 KiB
20Runtime error206ms522500 KiB
21Runtime error203ms522480 KiB
22Runtime error202ms522444 KiB
23Runtime error241ms522208 KiB
24Accepted19ms34452 KiB
subtask50/38
25Runtime error291ms522048 KiB
26Runtime error291ms522044 KiB
27Runtime error289ms521816 KiB
28Runtime error248ms521812 KiB
29Runtime error244ms521796 KiB
30Runtime error287ms521788 KiB
31Runtime error244ms521736 KiB
32Runtime error257ms521744 KiB
33Runtime error244ms521736 KiB
34Runtime error246ms521732 KiB
35Runtime error202ms521716 KiB
36Runtime error291ms521716 KiB
37Runtime error259ms521712 KiB
38Runtime error248ms521712 KiB
39Runtime error246ms521684 KiB
40Runtime error241ms521684 KiB
41Runtime error228ms521704 KiB
42Runtime error244ms521720 KiB
43Runtime error243ms521708 KiB
44Runtime error250ms521708 KiB