답안 #516283

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
516283 2022-01-21T02:26:55 Z MinhQNgo Addk (eJOI21_addk) C++17
36 / 100
2000 ms 3960 KB
#include <bits/stdc++.h>

using namespace std;

const int N = 1e6 + 5;

long long ps[N];
int a[N];

int main() {
    int n, k;
    cin >> n >> k;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        ps[i] = a[i] + ps[i - 1];
    }
    int q;
    cin >> q;
    while (q--) {
        int t;
        cin >> t;
        if (t == 1) {
            int ind;
            for (int i = 1; i <= k; i++) cin >> ind;
        }
        else {
            int l, r, m;
            cin >> l >> r >> m;
            long long ans = 0;
            for (int i = l; i <= r - m + 1; i++) {
                ans += ps[i + m - 1] - ps[i - 1];
            }
            cout << ans << '\n';
        }
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 3 ms 300 KB Output is correct
3 Correct 6 ms 332 KB Output is correct
4 Correct 9 ms 416 KB Output is correct
5 Correct 13 ms 448 KB Output is correct
6 Correct 18 ms 496 KB Output is correct
7 Correct 22 ms 544 KB Output is correct
8 Correct 27 ms 580 KB Output is correct
9 Correct 47 ms 636 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 145 ms 696 KB Output is correct
2 Correct 296 ms 1564 KB Output is correct
3 Correct 489 ms 2268 KB Output is correct
4 Correct 1800 ms 3748 KB Output is correct
5 Execution timed out 2076 ms 3960 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 766 ms 1384 KB Output isn't correct
2 Halted 0 ms 0 KB -