112682024-08-03 11:09:55bzyLegcsalódottabb versenyző (75 pont)cpp14Wrong answer 45/7537ms888 KiB
#include <bits/stdc++.h>

using namespace std;
int main()
{
	int n;
	cin>>n;
	vector<int> P(n);
	int mx = 0;
	for(auto& p : P){
	 	cin>>p;
	 	mx = max(p,mx);
	 }
	bool valid = false;
	bool maxed = false;
	int second;
	for(int i = 0;i<n;i++){
	 	if(P[i] != mx){ 
	 		second = i;
	 		valid = true;
	 		break;
	 	}
	 }
	if(valid == true){
		for(int i = 0;i<n;i++){
			if(P[i] != mx){
				if(P[i] > P[second]) second = i;
				if(maxed == true) break;
			}
			else{
				maxed = true;
				if(valid == true) break;
			}
		}
	}
	if(valid == true) cout<<second+1<<endl;
	else cout<<-1<<endl;
}
SubtaskSumTestVerdictTimeMemory
base45/75
1Accepted0/03ms356 KiB
2Wrong answer0/035ms740 KiB
3Accepted5/53ms356 KiB
4Accepted5/53ms356 KiB
5Accepted5/53ms612 KiB
6Wrong answer0/52ms256 KiB
7Accepted5/53ms384 KiB
8Accepted5/52ms356 KiB
9Wrong answer0/53ms356 KiB
10Wrong answer0/53ms356 KiB
11Wrong answer0/53ms408 KiB
12Accepted5/53ms376 KiB
13Accepted5/537ms888 KiB
14Accepted5/537ms740 KiB
15Wrong answer0/537ms788 KiB
16Wrong answer0/537ms632 KiB
17Accepted5/535ms740 KiB