191012025-11-23 12:23:59algoproInverziócpp17Compilation error
// UUID: 5119ecd9-1f1a-4979-89e4-0250c77cdfe9
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    cin >> n;
    vector<int> s(n+1);
    for (int i = 1; i <= n; i++) cin >> s[i];

    // jobbról haladva: min érték, annak indexe
    int minVal = INT_MAX;
    int minIdx = -1;

    long long bestDist = -1;
    int bestI = -1, bestJ = -1;

    for (int i = n; i >= 1; i--) {
        // először frissítjük a jobb oldali minimumot
        if (s[i] < minVal) {
            minVal = s[i];
            minIdx = i;
        }

        // majd megnézzük, képez-e inverziót
        if (s[i] > minVal) {
            long long dist = minIdx - i;
            if (dist > bestDist) {
                bestDist = dist;
                bestI = i;
                bestJ = minIdx;
            }
        }
    }

    if (bestDist == -1) {
        cout << -1 << "\n";
    } else {
        cout << bestI << " " << bestJ << "\n";
    }

    return 0;
}
Compilation error
open /var/local/lib/isolate/444/box/a.out: no such file or directory
main.cpp: In function 'int main()':
main.cpp:3:5: error: 'ios' has not been declared
    3 |     ios::sync_with_stdio(false);
      |     ^~~
main.cpp:4:5: error: 'cin' was not declared in this scope
    4 |     cin.tie(nullptr);
      |     ^~~
main.cpp:8:5: error: 'vector' was not declared in this scope
    8 |     vector<int> s(n+1);
      |     ^~~~~~
main.cpp:8:12: error: expected primary-expression before 'int'
    8 |     vector<int> s(n+1);
      |            ^~~
main.cpp:9:41: error: 's' was not declared in this scope
    9 |     for (int i = 1; i <= n; i++) cin >> s[i];
      |                                         ^
main.cpp:12:18: error: 'INT_MAX' was not declared in this scope
   12 |     int minVal = INT_MAX;
      |                  ^~~~~~~
main.cpp:1:1: note: 'INT_MAX' is defined in header '<climits>'; did you forget to '#include <climits>'?
  +++ |+#include <climits>
    1 | // UUID: 5119ecd9-1f1a-4979-89e4-0250c77cdfe9
main.cpp:20:13: error: 's' was not declared in this scope
   20 |         if (s[i] < minVal) {
      |             ^
main.cpp:26:13: error: 's' was not declared in this scope
   26 |         if (s[i] > minVal) {
      |             ^
main.cpp:37:9: error: 'cout' was not declared in this scope
   37 |         cout << -1 << "\n";
      |         ^~~~
main.cpp:39:9: error: 'cout' was not declared in this scope
   39 |         cout << bestI << " " << bestJ << "\n";
      |         ^~~~