121112024-12-02 15:38:45KissCsongor777Inverziócpp11Compilation error
#include <iostream>

using namespace std;

int main()
{
    int N,m=INT_MIN,a,b;
    cin>>N;
    int H[N+1];
    for(int i=1; i<=N; i++)cin>>H[i];
    for(int i=1; i<=N; i++)
    {
        for(int j=N+1; j>i; j--)
        {
            if(H[i]>H[j] && j-i>m)
                {
                    m=j-i;
                    a=i;
                    b=j;
                }
        }
    }
    if(m==INT_MIN)cout<<-1;
    else cout<<a<<" "<<b;
    return 0;
}
Compilation error
open /var/local/lib/isolate/443/box/a.out: no such file or directory
main.cpp: In function 'int main()':
main.cpp:7:13: error: 'INT_MIN' was not declared in this scope
    7 |     int N,m=INT_MIN,a,b;
      |             ^~~~~~~
main.cpp:2:1: note: 'INT_MIN' is defined in header '<climits>'; did you forget to '#include <climits>'?
    1 | #include <iostream>
  +++ |+#include <climits>
    2 | 
main.cpp:18:21: error: 'a' was not declared in this scope
   18 |                     a=i;
      |                     ^
main.cpp:19:21: error: 'b' was not declared in this scope
   19 |                     b=j;
      |                     ^
main.cpp:24:16: error: 'a' was not declared in this scope
   24 |     else cout<<a<<" "<<b;
      |                ^
main.cpp:24:24: error: 'b' was not declared in this scope
   24 |     else cout<<a<<" "<<b;
      |                        ^