28982023-02-02 12:47:40UnluckYInverziócpp11Wrong answer 47/5059ms8796 KiB
/*
4 3 5 1 2




4 5 2 1 3

*/


#include <bits/stdc++.h>

using namespace std;

int main(){

    ios_base::sync_with_stdio(0); cin.tie(0);

    int n; cin >> n;
    vector<int> v(n+1);

    for (int i = 0; i < n; i++){
        int a; cin >> a;
        v[a] = i+1;
    }

    int mx = 0, tav = 0, i = 0, j = 0;

    for (int x : v){

        mx = max(mx, x);

        if (mx - x > tav){
            i = mx; j = x; tav = mx-x;
        }

    }

    cout << j << " " << i;


    return 0;
}
SubtaskSumTestVerdictTimeMemory
base47/50
1Accepted0/03ms1696 KiB
2Accepted0/08ms2232 KiB
3Wrong answer0/13ms2140 KiB
4Accepted2/23ms2364 KiB
5Accepted7/73ms2508 KiB
6Accepted2/28ms3012 KiB
7Accepted2/257ms6604 KiB
8Accepted2/259ms6912 KiB
9Accepted2/259ms7220 KiB
10Accepted2/259ms7420 KiB
11Accepted2/259ms7584 KiB
12Accepted2/256ms7668 KiB
13Accepted2/257ms7668 KiB
14Accepted2/259ms7664 KiB
15Accepted2/257ms7972 KiB
16Accepted2/257ms7924 KiB
17Accepted2/257ms7928 KiB
18Accepted2/257ms7876 KiB
19Accepted3/357ms7876 KiB
20Accepted3/357ms8132 KiB
21Accepted2/257ms8348 KiB
22Accepted2/257ms8652 KiB
23Accepted2/259ms8596 KiB
24Wrong answer0/257ms8796 KiB