133852025-01-07 18:26:47ercseferencInverziócpp17Wrong answer 38/50173ms2552 KiB
#include <iostream>
using namespace std;
int a[500001]={};
int main()
{
    int n; cin>>n;
    for(int i=0; i<n; i++){cin>>a[i];}
    int maxi=a[0],tav=0,kezd,veg;
    for(int i=1; i<n; i++){
        if(maxi>a[i]){
            if(maxi-a[i]>tav){tav=maxi-a[i]; kezd=a[i]; veg=maxi;}}
        else maxi=a[i];}
    if(tav>0)cout<<kezd<<" "<<veg<<endl;
    else cout<<-1<<endl;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base38/50
1Accepted0/01ms500 KiB
2Accepted0/016ms560 KiB
3Accepted1/11ms316 KiB
4Accepted2/21ms316 KiB
5Accepted7/71ms316 KiB
6Wrong answer0/216ms484 KiB
7Accepted2/2171ms2304 KiB
8Accepted2/2173ms2100 KiB
9Accepted2/2170ms2220 KiB
10Wrong answer0/2171ms2180 KiB
11Wrong answer0/2171ms2280 KiB
12Wrong answer0/2166ms2276 KiB
13Accepted2/2171ms2356 KiB
14Accepted2/2170ms2148 KiB
15Accepted2/2170ms2368 KiB
16Accepted2/2171ms2140 KiB
17Wrong answer0/2171ms2356 KiB
18Accepted2/2170ms2100 KiB
19Accepted3/3170ms2356 KiB
20Accepted3/3171ms2196 KiB
21Accepted2/2171ms2356 KiB
22Accepted2/2170ms2324 KiB
23Wrong answer0/2171ms2552 KiB
24Accepted2/2172ms2140 KiB