| 15498 | 2025-02-20 08:24:17 | szj | Legmesszebbi rossz sorrendű (35 pont) | cpp17 | Compilation error |
#include <iostream>
#include <algorithm>
#include <fstream>
#define ff for(i=0; i<n; i++)
using namespace std;
struct kecske
{
int a, s;
};
bool f(kecske a, kecske b)
{
if(a.a!=b.a)return a.a < b.a;
else return a.i < b.i;
}
int main()
{
int n, i, mi=-1, ma=0, c=-1, d=-1;
cin >> n;
kecske t[n];
ff{
cin >> t[i].a;
t[i].s = i;
}
sort(t, t+n, f);
ff{
if(t[i].s > mi)mi=t[i].s;
if(mi > t[i].s && mi-t[i].s > ma)
{
c = mi+1;
d = t[i].s+1;
ma = mi-t[i].s;
}
}
if(d==-1)cout<<-1;
else cout << d << " " << c;
return 0;
}
open /var/local/lib/isolate/434/box/a.out: no such file or directory
main.cpp: In function 'bool f(kecske, kecske)':
main.cpp:13:19: error: 'struct kecske' has no member named 'i'
13 | else return a.i < b.i;
| ^
main.cpp:13:25: error: 'struct kecske' has no member named 'i'
13 | else return a.i < b.i;
| ^