Submission #526250

#TimeUsernameProblemLanguageResultExecution timeMemory
526250veosHedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++11
34 / 100
3050 ms39084 KiB
#include <stdio.h>
using namespace std;
int main(){
	int n,m;
	scanf("%d %d",&n,&m);
	int b[n++];
	b[0]=0;
	for(int i=1;i<n;i++)
		scanf("%d",&b[i]);
do{
	int c=b[0];
	int r,l,k;
	bool f = true;
	scanf("%d %d %d",&r,&l,&k);
	for(int i=r; i<=l;i++){
		if(c>b[i])
		{
			if(c+b[i]>k){
				f=false;
				break;
			}
		}
		else
			c=b[i];
	}
	printf("%d\n",f);
	m--;
	}while(m>0);
}

Compilation message (stderr)

sortbooks.cpp: In function 'int main()':
sortbooks.cpp:5:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    5 |  scanf("%d %d",&n,&m);
      |  ~~~~~^~~~~~~~~~~~~~~
sortbooks.cpp:9:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |   scanf("%d",&b[i]);
      |   ~~~~~^~~~~~~~~~~~
sortbooks.cpp:14:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |  scanf("%d %d %d",&r,&l,&k);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...