| 22545 | 2026-01-15 10:55:25 | PappMatyas | Inverzió | cpp17 | Compilation error |
#include<iostream>
#include<vector>
using namespace std;
int main()
{
ios.sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
vector<int> v(n);
for(int i = 0; i < n; i++)
{
cin >> v[i];
}
int b = -1, e = -1;
int maxLength = 0;
int maxi = -1;
for(int i = 0; i < n - maxLength - 1; i++)
{
if(v[i] < maxi)
{
continue;
}
for(int j = n - 1; j > i; j--)
{
if(v[i] > v[j])
{
if(j - i > e - b)
{
b = i + 1;
e = j + 1;
maxLength = e - b;
break;
}
}
}
maxi = max(maxi, v[i]);
}
if(e != -1)
{
cout << b << " " << e;
}
else
{
cout << -1;
}
}
open /var/local/lib/isolate/402/box/a.out: no such file or directory
main.cpp: In function 'int main()':
main.cpp:8:8: error: expected unqualified-id before '.' token
8 | ios.sync_with_stdio(false);
| ^