39032023-03-03 20:07:52kohumarkMágikus táblázatcpp17Time limit exceeded 14/100600ms5628 KiB
#include <iostream>
#include <vector>
using namespace std;

int main(){
    cin.tie(0); ios_base::sync_with_stdio(false);
    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];
    
    vector<int> act; act.assign(m,0);
    int l=0; int ma=1e9; int sol=0;
    for(int i=0; i<n; i++){
        for(int j=0; j<m; j++){
            if(a[i]>=b[j]){
                act[j]++;
            }
            else{act[j]=0;}
        }
        for(int j=0; j<m; j++){
            ma=1e9;
            for(int k=j; k<m; k++){
                ma=min(ma,act[k]); sol=max(ma*(k-j+1),sol);
            }
        }
    }
    
    cout << sol;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1828 KiB
2Time limit exceeded600ms1496 KiB
subtask214/14
3Accepted3ms2444 KiB
4Accepted3ms2648 KiB
5Accepted3ms2732 KiB
6Accepted3ms2712 KiB
7Accepted3ms2676 KiB
8Accepted3ms2904 KiB
subtask30/27
9Time limit exceeded564ms3124 KiB
10Time limit exceeded578ms3160 KiB
11Time limit exceeded565ms3288 KiB
12Time limit exceeded578ms3500 KiB
13Time limit exceeded555ms3544 KiB
14Time limit exceeded555ms3676 KiB
15Time limit exceeded564ms3776 KiB
16Time limit exceeded540ms4124 KiB
17Time limit exceeded523ms4080 KiB
subtask40/21
18Time limit exceeded551ms4332 KiB
19Time limit exceeded560ms4396 KiB
20Time limit exceeded583ms4464 KiB
21Time limit exceeded555ms4668 KiB
22Time limit exceeded560ms4368 KiB
23Time limit exceeded536ms4308 KiB
24Time limit exceeded566ms4136 KiB
subtask50/38
25Time limit exceeded579ms4820 KiB
26Time limit exceeded572ms5276 KiB
27Time limit exceeded527ms5144 KiB
28Time limit exceeded578ms5208 KiB
29Time limit exceeded575ms5092 KiB
30Time limit exceeded568ms4820 KiB
31Time limit exceeded579ms4896 KiB
32Time limit exceeded580ms4588 KiB
33Time limit exceeded540ms4740 KiB
34Time limit exceeded579ms5040 KiB
35Time limit exceeded547ms5056 KiB
36Time limit exceeded564ms5588 KiB
37Time limit exceeded551ms5584 KiB
38Time limit exceeded588ms5556 KiB
39Time limit exceeded560ms5628 KiB
40Time limit exceeded540ms5500 KiB
41Time limit exceeded560ms5176 KiB
42Time limit exceeded572ms5428 KiB
43Time limit exceeded549ms5448 KiB
44Time limit exceeded552ms5332 KiB