12112 | 2024-12-02 15:41:50 | KissCsongor777 | Inverzió | cpp11 | Compilation error |
#include <iostream>
using namespace std;
int H[500001];
int main()
{
int N,m=INT_MIN,a,b;
cin>>N;
for(int i=1; i<=N; i++)cin>>H[i];
for(int i=1; i<=N; i++)
{
for(int j=N; 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;
}
open /var/local/lib/isolate/401/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;
| ^