| 17879 | 2025-09-21 19:52:15 | algopro | Fasor (40) | cpp17 | Forditási hiba |
// UUID: c763751c-577d-4b71-8d57-54d8bc3cc212
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
int K;
cin>>N>>K;
int pos=0;
int h=0;
int maxpos=0;
while(pos<N){
int actual;
cin>>actual;
if(actual>h){
h=actual;
maxpos=pos;
}
if(pos-maxpos>K){
cout<<maxpos;
exit(0)
}
pos++
}
}
open /var/local/lib/isolate/401/box/a.out: no such file or directory
main.cpp: In function 'int main()':
main.cpp:21:32: error: expected ';' before '}' token
21 | exit(0)
| ^
| ;
22 | }
| ~
main.cpp:23:22: error: expected ';' before '}' token
23 | pos++
| ^
| ;
24 | }
| ~