154322025-02-19 15:54:38PKBLegcsalódottabb versenyző (75 pont)cpp17Accepted 75/7512ms1012 KiB
#include <iostream>
#include <vector>
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    cin >> n;
    vector<int> score(n);
    for (int i = 0; i < n; i++){
        cin >> score[i];
    }

    int bestDuration = -1;
    int bestCandidate = -1;

    int lastRecordIndex = 0;
    int lastRecordScore = score[0];

    for (int i = 1; i < n; i++){
        if(score[i] > lastRecordScore){
            int duration = i - lastRecordIndex;
            if(duration > bestDuration){
                bestDuration = duration;
                bestCandidate = lastRecordIndex;
            }
            lastRecordIndex = i;
            lastRecordScore = score[i];
        }
    }

    if(bestCandidate == -1) {
        cout << -1;
    } else {
        cout << bestCandidate + 1;
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/01ms316 KiB
2Accepted0/012ms820 KiB
3Accepted5/51ms316 KiB
4Accepted5/51ms316 KiB
5Accepted5/51ms328 KiB
6Accepted5/51ms316 KiB
7Accepted5/51ms372 KiB
8Accepted5/51ms316 KiB
9Accepted5/51ms508 KiB
10Accepted5/51ms316 KiB
11Accepted5/51ms316 KiB
12Accepted5/51ms316 KiB
13Accepted5/512ms820 KiB
14Accepted5/512ms1004 KiB
15Accepted5/512ms820 KiB
16Accepted5/512ms820 KiB
17Accepted5/512ms1012 KiB