Submission #218340

#TimeUsernameProblemLanguageResultExecution timeMemory
218340LawlietHedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++17
8 / 100
3099 ms4216 KiB
#include <bits/stdc++.h> using namespace std; const int MAXN = 1000010; int n, q; int v[MAXN]; int main() { scanf("%d %d",&n,&q); for(int i = 1 ; i <= n ; i++) scanf("%d",&v[i]); for(int i = 1 ; i <= q ; i++) { int L, R, k; scanf("%d %d %d",&L,&R,&k); int mx = 0; for(int a = L ; a <= R ; a++) { for(int b = a ; b >= L ; b--) { if( v[b] <= v[a] ) continue; mx = max( mx , v[b] + v[a] ); } } if( mx <= k ) printf("1\n"); else printf("0\n"); } }

Compilation message (stderr)

sortbooks.cpp: In function 'int main()':
sortbooks.cpp:13:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d",&n,&q);
  ~~~~~^~~~~~~~~~~~~~~
sortbooks.cpp:16:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&v[i]);
   ~~~~~^~~~~~~~~~~~
sortbooks.cpp:21:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d %d",&L,&R,&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...