제출 #321551

#제출 시각아이디문제언어결과실행 시간메모리
321551tushar_2658Hedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++14
17 / 100
66 ms364 KiB
#include "bits/stdc++.h" using namespace std; const int maxn = 5005; using ll = long long; ll a[maxn]; bool get(int l, int r, ll k){ bool good = 1; stack<int> st; for(int i = r; i >= l; --i){ while(!st.empty() && a[st.top()] < a[i]){ if(a[i] + a[st.top()] > k){ good = 0; break; } st.pop(); } if(!good)break; st.push(i); } return good; } int main(int argc, char const *argv[]) { int n, q; scanf("%d %d", &n, &q); for(int i = 1; i <= n; ++i){ scanf("%lld", &a[i]); } while(q--){ int l, r; ll k; scanf("%d %d %lld", &l, &r, &k); bool ans = get(l, r, k); printf("%d\n", ans); } return 0; }

컴파일 시 표준 에러 (stderr) 메시지

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