Submission #681758

# Submission time Handle Problem Language Result Execution time Memory
681758 2023-01-14T07:36:24 Z SnoT Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++14
0 / 100
3000 ms 9048 KB
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long
#define ull unsigned long long
#define ssort sort(s.begin(),s.end());
#define sreverse reverse(s.begin(),s.end());
#define sclear s.clear();
#define ssize s.size();
#define ld long double
#define F first
#define S second
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define sq(a) (a)*(a)
/*void fopn(string name){
	freopen((name+".in").c_str(),"r",stdin);
	freopen((name+".out").c_str(),"w",stdout);
}*/
ll a,b,c,e,d,f,k,g,h,q[2000000],i,j,x,y,z,m,n,l,r,w,t,p,s,u,sum,ans,mod=1e18;
int main(){
	ios::sync_with_stdio(0);
    cin.tie(0);
    cin>>n>>m;
    for(i=1;i<=n;i++)
    {
    	cin>>q[i];
	}
	for(i=1;i<=m;i++)
	{
		cin>>l>>r>>k;
		t=0; x=q[l];
    for(j=l+1;j<=r;j++){
        if(x>q[j]) t=max(t,x+q[j]);
        x=max(x,q[j]);
    }

    cout<<t-x-1<<endl;
	}
	
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3070 ms 9048 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2696 ms 3280 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -