| Task: | Hamilton |
| Sender: | RJuknevicius |
| Submission time: | 2026-04-17 12:20:57 +0300 |
| Language: | C++ (C++20) |
| Status: | COMPILE ERROR |
Compiler report
input/code.cpp: In function 'int main()':
input/code.cpp:20:34: error: expected ';' before 'lmin'
20 | if(x[i-1]>x[i]) wrong
| ^
| ;
21 | lmin[i]=min(lmin[i-1], x[i]);
| ~~~~
input/code.cpp:20:29: warning: statement has no effect [-Wunused-value]
20 | if(x[i-1]>x[i]) wrong
| ^~~~~Code
#include <bits/stdc++.h>
using namespace std;
int lmin[200000], rmin[200000], lmax[200000], rmax[200000], x[200000], xs[200000], t[800001], wrong[200000];
int main()
{
int n,q;
cin>>n>>q;
for(int i = 0; i < n; i++)
{
cin>>x[i];
xs[i]=x[i];
if(i==0) {lmin[i]=x[i];lmax[i]=x[i];}
else {
if(x[i-1]>x[i]) wrong
lmin[i]=min(lmin[i-1], x[i]);
lmax[i]=max(lmax[i-1], x[i]);
}
}
sort(xs, xs+n);
rmax[n-1]=x[n-1];
rmin[n-1]=x[n-1];
for(int i = n-2; i >=0; i--)
{
rmin[i]=min(rmin[i+1], x[i]);
rmax[i]=max(rmax[i+1], x[i]);
}
for(int i = 0; i < q;i++)
{
}
}
