| 19736 | 2025-12-20 18:04:06 | Gergoszabo | Programtermék verseny (70 pont) | cpp17 | Forditási hiba |
#include <iostream>
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main()
{
ll n, k; cin >> n >> k;
vector<ll> v(n+1, 0);
for (ll i = 1; i <= n; i++){
cin >> v[i];
}
ll ranking = 1;
ll g = 0, s = 0, b = 0;
for (ll i = 1; i < k; i++){
// if (ranking <= n/12) g = i;
// else if (ranking <= n/4) s = i;
// else if (ranking <= n/2) b = i;
if (v[i] > v[k]) ranking++;
}
if (ranking <= n/12) g = i;
else if (ranking <= n/4) s = i;
else if (ranking <= n/2) b = i;
for (ll i = k+1; i <= n; i++){
if (v[i] > v[k]) ranking++;
if (ranking <= n/12) g = i;
else if (ranking <= n/4) s = i;
else if (ranking <= n/2) b = i;
}
if (ranking <= n/12) g = n;
else if (ranking <= n/4) s = n;
else if (ranking <= n/2) b = n;
cout << g << "\n" << s << "\n" << b;
return 0;
}
open /var/local/lib/isolate/424/box/a.out: no such file or directory
main.cpp: In function 'int main()':
main.cpp:21:30: error: 'i' was not declared in this scope
21 | if (ranking <= n/12) g = i;
| ^
main.cpp:22:34: error: 'i' was not declared in this scope
22 | else if (ranking <= n/4) s = i;
| ^
main.cpp:23:34: error: 'i' was not declared in this scope
23 | else if (ranking <= n/2) b = i;
| ^