답안 #1114940

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1114940 2024-11-19T20:02:49 Z AdamGS Fire (JOI20_ho_t5) C++17
0 / 100
630 ms 262144 KB
#include <bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n,q,k,l,p,maks=0;
    cin >> n >> q;
    vector<int>c1;
    vector<vector<int>>c3;
    for(int i=0;i<n;++i){
        cin >> k;
        c1.push_back(k);   
    }
    for(int i=0;i<200;++i){
        for(int j=n-1;j>0;--j){
            c1[j]=max(c1[j],c1[j-1]);
        }
        c3.push_back(c1);
    }
    for(int i=0;i<q;++i){
        cin >> k >> l >>p;
        int suma=0;
        for(int j=l-1;j<p;++j){
            suma +=c3[k-1][j];
        }
        cout << suma <<  endl;
    }

    return 0;
}

Compilation message

ho_t5.cpp: In function 'int main()':
ho_t5.cpp:6:19: warning: unused variable 'maks' [-Wunused-variable]
    6 |     int n,q,k,l,p,maks=0;
      |                   ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Incorrect 1 ms 592 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Runtime error 620 ms 262144 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Runtime error 611 ms 262144 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 630 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Incorrect 1 ms 592 KB Output isn't correct
3 Halted 0 ms 0 KB -