Submission #382147

#TimeUsernameProblemLanguageResultExecution timeMemory
382147BartolMHedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++17
0 / 100
3093 ms27692 KiB
#include <bits/stdc++.h> using namespace std; #define X first #define Y second #define mp make_pair #define pb push_back typedef long long ll; typedef pair <int, int> pii; typedef pair <int, pii> pip; typedef pair <pii, int> ppi; typedef pair <ll, ll> pll; const int INF=0x3f3f3f3f; const int N=1e6+50; const int OFF=(1<<20); int n, q; int p[N], sol[N]; int T[2*OFF], levi[N]; vector <ppi> que[N]; vector <int> st; void load() { scanf("%d %d", &n, &q); for (int i=0; i<n; ++i) scanf("%d", &p[i]); for (int i=0; i<q; ++i) { int a, b, c; scanf("%d %d %d", &a, &b, &c); int res=0; for (int j=a; j<=b; ++j) { for (int k=j+1; k<=b; ++k) { if (p[k]<p[j]) res=max(res, p[j]+p[k]); } } printf("%d\n", res<=c); } } int main() { load(); return 0; }

Compilation message (stderr)

sortbooks.cpp: In function 'void load()':
sortbooks.cpp:26:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   26 |     scanf("%d %d", &n, &q);
      |     ~~~~~^~~~~~~~~~~~~~~~~
sortbooks.cpp:27:34: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   27 |     for (int i=0; i<n; ++i) scanf("%d", &p[i]);
      |                             ~~~~~^~~~~~~~~~~~~
sortbooks.cpp:30:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   30 |         scanf("%d %d %d", &a, &b, &c);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
#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...