| 14838 | 2025-02-04 13:51:08 | markfsibian | Legmesszebbi rossz sorrendű (35 pont) | cpp17 | Compilation error |
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
multimap<int, int> v;
int main()
{
int n;
cin >> n;
int t;
for (int i = 1; i <= n; ++i)
{
cin >> t;
v.insert({ t, i });
}
int maxi = 0, res = -1, ind = -1;
for (auto& e : v)
{
if (e.second > maxi)
maxi = e.second;
if (maxi - e.second > res)
res = maxi - e.second;
}
if (res == -1)
cout << -1;
else
// TODO: a maxi a legnagyobb koordinata
// => a legkissebb a maxi - tavolsag
/*
for (int i = 1; i <= n; ++i)
int maxi = 1, ind=0, t;
for (int i = 1; i < n; ++i)
{
for (int j = i + 1; j <= n; ++j)
{
if (v[i] > v[j] && j - i > maxi)
{
maxi = j - i;
ind = i;
}
}
}
if (ind)
cout << ind << " " << ind + maxi;
else
cout << -1;
*/
}
open /var/local/lib/isolate/413/box/a.out: no such file or directory
main.cpp: In function 'int main()':
main.cpp:59:1: error: expected primary-expression before '}' token
59 | }
| ^