Submission #490682

# Submission time Handle Problem Language Result Execution time Memory
490682 2021-11-28T16:35:58 Z irmuun Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++17
0 / 100
3000 ms 5664 KB
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
	ll n,m,w[200001],h[200001],l,r,k,ans,i,j,b,c;
	cin>>n>>m;
	for(i=1;i<=n;i++){
		cin>>w[i];
		h[i]=w[i];
	}
	for(i=1;i<=m;i++){
		cin>>l>>r>>k;
		c=0;
		while(c==0){
			c=1;
			for(j=l;j<r;j++){
				if(w[i]+w[i+1]<=k&&w[i]>w[i+1]){
					c=0;
					swap(w[i],w[i+1]);
				}
			}
		}
		c=1;
		for(j=l;j<r;j++){
			if(w[i]>w[i+1]){
				c=0;
				break;
			}
		}
		cout<<c<<endl;
	}
}

Compilation message

sortbooks.cpp: In function 'int main()':
sortbooks.cpp:5:19: warning: variable 'h' set but not used [-Wunused-but-set-variable]
    5 |  ll n,m,w[200001],h[200001],l,r,k,ans,i,j,b,c;
      |                   ^
sortbooks.cpp:5:35: warning: unused variable 'ans' [-Wunused-variable]
    5 |  ll n,m,w[200001],h[200001],l,r,k,ans,i,j,b,c;
      |                                   ^~~
sortbooks.cpp:5:43: warning: unused variable 'b' [-Wunused-variable]
    5 |  ll n,m,w[200001],h[200001],l,r,k,ans,i,j,b,c;
      |                                           ^
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1852 KB Output is correct
2 Correct 1 ms 1740 KB Output is correct
3 Incorrect 2 ms 1864 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1852 KB Output is correct
2 Correct 1 ms 1740 KB Output is correct
3 Incorrect 2 ms 1864 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 81 ms 5664 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3066 ms 3896 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1852 KB Output is correct
2 Correct 1 ms 1740 KB Output is correct
3 Incorrect 2 ms 1864 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1852 KB Output is correct
2 Correct 1 ms 1740 KB Output is correct
3 Incorrect 2 ms 1864 KB Output isn't correct
4 Halted 0 ms 0 KB -