Submission #224149

#TimeUsernameProblemLanguageResultExecution timeMemory
224149SomeoneUnknownFire (JOI20_ho_t5)C++14
0 / 100
147 ms9968 KiB
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> ii; ii mii(int a, int b){ return make_pair(a,b); } int main(){ int n, q; scanf("%d %d", &n, &q); bool constt = true; int str[n]; for(int i = 0; i < n; i++){ scanf("%d", &str[i]); } int ts[q]; int ss[q]; int es[q]; for(int i = 0; i < q; i++){ scanf("%d %d %d", &ts[i], &ss[i], &es[i]); if(i > 0 && ts[i] != ts[i-1]) constt = false; } if(constt){ deque<ii> dq; int spfs[n+1]; spfs[0] = 0; for(int i = 0; i < n; i++){ if(i > ts[0]){ while(dq.front().second < i-ts[0]) dq.pop_front(); } while(!dq.empty() && dq.back().first < str[i]){ dq.pop_back(); } dq.push_back(mii(str[i], i)); spfs[i+1] = spfs[i] + dq.front().first; } for(int i = 0; i < q; i++){ printf("%d\n", spfs[es[i]]-spfs[ss[i]-1]); } } }

Compilation message (stderr)

ho_t5.cpp: In function 'int main()':
ho_t5.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d", &n, &q);
     ~~~~~^~~~~~~~~~~~~~~~~
ho_t5.cpp:15:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &str[i]);
         ~~~~~^~~~~~~~~~~~~~~
ho_t5.cpp:21:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d %d", &ts[i], &ss[i], &es[i]);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#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...