131062025-01-06 15:19:46ercseferencFasor (40)cpp17Wrong answer 14/4071ms2444 KiB
#include <iostream>
using namespace std;
int main()
{
    int n,m; cin>>n>>m;
    int a[n]; for(int i=0; i<n; i++){cin>>a[i];}
    bool megvan=0; int j=0,maxi,maxind;
    while(!megvan){
        maxi=0;
        for(int i=j+1; i<=j+m; i++){
            if(i==n)break;
            if(a[i]>=maxi){maxi=a[i]; maxind=i;}}
        if(maxi<=a[j])megvan=1;
        else j=maxind;}
    cout<<j+1;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base14/40
1Accepted0/01ms316 KiB
2Accepted0/04ms316 KiB
3Wrong answer0/21ms316 KiB
4Accepted2/21ms500 KiB
5Accepted2/21ms316 KiB
6Accepted2/21ms316 KiB
7Wrong answer0/21ms316 KiB
8Accepted2/22ms316 KiB
9Accepted2/24ms316 KiB
10Accepted2/24ms460 KiB
11Wrong answer0/24ms408 KiB
12Wrong answer0/23ms316 KiB
13Wrong answer0/235ms1368 KiB
14Wrong answer0/232ms1128 KiB
15Wrong answer0/256ms1924 KiB
16Wrong answer0/264ms2356 KiB
17Wrong answer0/271ms2432 KiB
18Wrong answer0/271ms2372 KiB
19Wrong answer0/271ms2444 KiB
20Wrong answer0/221ms896 KiB
21Wrong answer0/257ms2100 KiB
22Accepted2/270ms2400 KiB