130792025-01-05 16:14:27ercseferencInverziócpp17Wrong answer 24/50600ms2368 KiB
#include <iostream>
using namespace std;
int main()
{
    int n; cin>>n;
    int a[n]; for(int i=0; i<n; i++){cin>>a[i];}
    int hn=-1,hk=-1,hki=-1,s=0,kez,veg;
    for(int i=0; i<n; i++){
        if(i>hki){
            if(s<hn-hk){s=hn-hk; kez=hk; veg=hn;}
            hk=n+1; hn=a[i];
            for(int j=i; j<n; j++){if(a[j]<hk){hk=a[j]; hki=j;}}}
        if(a[i]>hn)hn=a[i];}
    if(s==0)cout<<"-1";
    else cout<<kez<<" "<<veg;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base24/50
1Accepted0/01ms508 KiB
2Accepted0/027ms568 KiB
3Accepted1/11ms320 KiB
4Accepted2/21ms320 KiB
5Accepted7/71ms508 KiB
6Wrong answer0/217ms504 KiB
7Time limit exceeded0/2600ms2184 KiB
8Accepted2/2174ms2328 KiB
9Accepted2/2178ms2104 KiB
10Wrong answer0/2174ms2148 KiB
11Wrong answer0/2175ms2172 KiB
12Wrong answer0/2172ms2156 KiB
13Accepted2/2178ms2180 KiB
14Accepted2/2177ms2104 KiB
15Time limit exceeded0/2551ms2268 KiB
16Accepted2/2177ms2360 KiB
17Wrong answer0/2178ms2140 KiB
18Accepted2/2180ms2104 KiB
19Time limit exceeded0/3551ms2104 KiB
20Time limit exceeded0/3600ms2104 KiB
21Time limit exceeded0/2574ms2140 KiB
22Accepted2/2179ms2368 KiB
23Wrong answer0/2175ms2104 KiB
24Time limit exceeded0/2570ms2104 KiB