답안 #940962

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
940962 2024-03-08T03:13:22 Z LittleOrange Fire (JOI20_ho_t5) C++17
7 / 100
1000 ms 20048 KB
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
struct obj{
    ll t,l,r,i;
    bool operator<(const obj &o) const{
        return t<o.t;
    }
};
int main(){
    ios::sync_with_stdio(0);cin.tie(0);
    ll n,q;
    cin >> n >> q;
    vector<ll> a(n);
    for(ll &i : a) cin >> i;
    vector<obj> qs(q);
    for(ll i = 0;i<q;i++){
        qs[i].i = i;
        cin >> qs[i].t >> qs[i].l >> qs[i].r;
    }
    sort(qs.begin(),qs.end());
    vector<ll> ans(q);
    vector<ll> b(n+1,0);
    for(ll i = 0;i<n;i++) b[i+1] = a[i]+b[i];
    ll t = 0;
    for(obj o : qs){
        ll dt = o.t-t;
        if(dt){
            deque<pair<ll,ll>> q;
            for(ll i = 0;i<n;i++){
                while(q.size()&&q.front().second<i-dt) q.pop_front();
                while(q.size()&&q.back().first<=a[i]) q.pop_back();
                q.push_back({a[i],i});
                a[i] = q.front().first;
            }
            for(ll i = 0;i<n;i++) b[i+1] = a[i]+b[i];
            t = o.t;
        }
        //for(ll i = 0;i<n;i++) cout << a[i] << " \n"[i+1==n];
        ans[o.i] = b[o.r]-b[o.l-1];
    }
    for(ll i : ans) cout << i << "\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 596 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 452 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 344 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 1 ms 344 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 1 ms 348 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 83 ms 19516 KB Output is correct
3 Correct 82 ms 19540 KB Output is correct
4 Correct 79 ms 19688 KB Output is correct
5 Correct 73 ms 19524 KB Output is correct
6 Correct 73 ms 19288 KB Output is correct
7 Correct 75 ms 19796 KB Output is correct
8 Correct 85 ms 19532 KB Output is correct
9 Correct 73 ms 19800 KB Output is correct
10 Correct 73 ms 19604 KB Output is correct
11 Correct 74 ms 20048 KB Output is correct
12 Correct 72 ms 19280 KB Output is correct
13 Correct 82 ms 19296 KB Output is correct
14 Correct 73 ms 19284 KB Output is correct
15 Correct 74 ms 19388 KB Output is correct
16 Correct 72 ms 19280 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Execution timed out 1050 ms 16892 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1016 ms 14928 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 596 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 452 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 344 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 1 ms 344 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 1 ms 348 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 83 ms 19516 KB Output is correct
34 Correct 82 ms 19540 KB Output is correct
35 Correct 79 ms 19688 KB Output is correct
36 Correct 73 ms 19524 KB Output is correct
37 Correct 73 ms 19288 KB Output is correct
38 Correct 75 ms 19796 KB Output is correct
39 Correct 85 ms 19532 KB Output is correct
40 Correct 73 ms 19800 KB Output is correct
41 Correct 73 ms 19604 KB Output is correct
42 Correct 74 ms 20048 KB Output is correct
43 Correct 72 ms 19280 KB Output is correct
44 Correct 82 ms 19296 KB Output is correct
45 Correct 73 ms 19284 KB Output is correct
46 Correct 74 ms 19388 KB Output is correct
47 Correct 72 ms 19280 KB Output is correct
48 Execution timed out 1050 ms 16892 KB Time limit exceeded
49 Halted 0 ms 0 KB -