Submission #1114841

# Submission time Handle Problem Language Result Execution time Memory
1114841 2024-11-19T17:00:39 Z AdamGS Fire (JOI20_ho_t5) C++17
0 / 100
1000 ms 10912 KB
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    long long n, q;
    cin>>n>>q;
    vector<long long> vect(n);
    for (long long i=0;i<n;i++) cin>>vect[i];
    long long t;
    cin>>t;
    for (long long i=0;i<t;i++){
        for (long long j=n-2;j>=0;j--){
            if (vect[j]>vect[j+1]) vect[j+1]=vect[j];
        }
    }
    vector<long long> prefSums(n+1);
    for (int i=1;i<=n;i++) prefSums[i]=vect[i-1]+prefSums[i-1];
    for (int qe=0;qe<q;qe++){
        if (qe>0) cin>>t;
        int l, r;
        cin>>l>>r;
        cout<<prefSums[r]-prefSums[l-1]<<'\n';
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Incorrect 1 ms 336 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Execution timed out 1041 ms 3920 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Incorrect 929 ms 10912 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1052 ms 2384 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Incorrect 1 ms 336 KB Output isn't correct
3 Halted 0 ms 0 KB -