142752025-01-10 11:26:41badamFasor (40)cpp17Wrong answer 4/40300ms3572 KiB
#include <iostream>
#include <algorithm>

using namespace std;
struct fa
{
    int magas, sorszam;
};
int kisebb(fa f1, fa f2)
{
    if(f1.magas<=f2.magas)
    {
        return 1;
    }
    else
    {
        return 0;
    }
}

int main()
{
    int n, k;
    int x;
    int y;
    int a, b, c;
    int p=0;
    cin >> n >> k;
     fa t[n];
    for(int i=0;i<n;i++)
    {
        cin >> t[i].magas;
        t[i].sorszam=i;
    }

    fa f[n];
    for(int i=0;i<n;i++) {f[i].magas=t[i].magas;
        f[i].sorszam=t[i].sorszam;}


    for(int i=0; i<n and p==0;i++)
    {
      sort(f, f+i, kisebb);
      x=f[i].magas;
       for(int i=0;i<n and p==0;i++) {f[i].magas=t[i].magas;
        f[i].sorszam=t[i].sorszam;}
      if (x==t[i].magas)
      {
          sort(f+i,f+i+k,kisebb);
          y=f[i+k].magas;
          if(t[i].magas>=y)
          {
              p++;
              a=i;
          }

      }

    }

cout << a+1;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base4/40
1Accepted0/01ms316 KiB
2Wrong answer0/04ms452 KiB
3Wrong answer0/21ms316 KiB
4Accepted2/21ms316 KiB
5Runtime error0/21ms316 KiB
6Wrong answer0/21ms316 KiB
7Wrong answer0/21ms316 KiB
8Wrong answer0/22ms316 KiB
9Accepted2/24ms408 KiB
10Wrong answer0/24ms332 KiB
11Runtime error0/24ms432 KiB
12Wrong answer0/23ms316 KiB
13Time limit exceeded0/2300ms1756 KiB
14Time limit exceeded0/2277ms1844 KiB
15Time limit exceeded0/2289ms3368 KiB
16Time limit exceeded0/2300ms3304 KiB
17Time limit exceeded0/2287ms3408 KiB
18Time limit exceeded0/2284ms3372 KiB
19Runtime error0/2133ms3572 KiB
20Time limit exceeded0/2300ms1804 KiB
21Time limit exceeded0/2279ms3380 KiB
22Wrong answer0/279ms3316 KiB