# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
224158 | SomeoneUnknown | Fire (JOI20_ho_t5) | C++14 | 163 ms | 7980 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
long long 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("%lld\n", spfs[es[i]]-spfs[ss[i]-1]);
}
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |