Submission #371163

#TimeUsernameProblemLanguageResultExecution timeMemory
371163daniel920712Hedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++14
30 / 100
642 ms11100 KiB
#include <iostream> #include <stdio.h> #include <stdlib.h> using namespace std; int all[1000005]; int last[1000005]; int main() { int N,M,x,y,z,t,i,j,big; scanf("%d %d",&N,&M); for(i=1;i<=N;i++) scanf("%d",&all[i]); if(N<=5000&&M<=5000) { while(M--) { scanf("%d %d %d",&x,&y,&z); t=0; big=0; for(i=x;i<=y;i++) { if(all[i]>=big) big=all[i]; else if(all[i]+big>z) t=1; } if(t==0) printf("1\n"); else printf("0\n"); } } else { last[1]=1; for(i=2;i<=N;i++) { if(all[i]>=all[i-1]) last[i]=last[i-1]; else last[i]=i; } while(M--) { scanf("%d %d %d",&x,&y,&z); if(last[y]<=x) printf("1\n"); else printf("0\n"); } } return 0; }

Compilation message (stderr)

sortbooks.cpp: In function 'int main()':
sortbooks.cpp:10:23: warning: unused variable 'j' [-Wunused-variable]
   10 |     int N,M,x,y,z,t,i,j,big;
      |                       ^
sortbooks.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   11 |     scanf("%d %d",&N,&M);
      |     ~~~~~^~~~~~~~~~~~~~~
sortbooks.cpp:12:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   12 |     for(i=1;i<=N;i++) scanf("%d",&all[i]);
      |                       ~~~~~^~~~~~~~~~~~~~
sortbooks.cpp:17:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   17 |             scanf("%d %d %d",&x,&y,&z);
      |             ~~~~~^~~~~~~~~~~~~~~~~~~~~
sortbooks.cpp:39:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   39 |             scanf("%d %d %d",&x,&y,&z);
      |             ~~~~~^~~~~~~~~~~~~~~~~~~~~
#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...