Submission #747003

# Submission time Handle Problem Language Result Execution time Memory
747003 2023-05-23T11:33:05 Z pascal Addk (eJOI21_addk) C++14
92 / 100
262 ms 6604 KB
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int N, K, Q;
    cin >> N >> K;
    vector<long long> A(N), S(N + 1), S2(N + 2);
    for (int i = 0; i < N; i++)
        cin >> A[i];
    cin >> Q;
    for (int i = 0; i < N; i++)
    {
        S[i + 1] = S[i] + A[i];
        S2[i + 2] = S2[i + 1] + S[i + 1];
    }

    for (int i = 0; i < Q; i++)
    {
        int a, l, r, m;
        cin >> a;
        if (a == 1)
            for (int j = 0; j < K; j++)
                cin >> a;
        else
        {
            cin >> l >> r >> m;
            cout << S2[r + 1] + S2[l - 1] - S2[r - m + 1] - S2[l + m - 1] << endl;
        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 3 ms 340 KB Output is correct
3 Correct 5 ms 400 KB Output is correct
4 Correct 7 ms 468 KB Output is correct
5 Correct 10 ms 468 KB Output is correct
6 Correct 12 ms 564 KB Output is correct
7 Correct 21 ms 604 KB Output is correct
8 Correct 20 ms 652 KB Output is correct
9 Correct 25 ms 852 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 50 ms 1472 KB Output is correct
2 Correct 82 ms 2124 KB Output is correct
3 Correct 113 ms 2732 KB Output is correct
4 Correct 170 ms 4620 KB Output is correct
5 Correct 262 ms 6604 KB Output is correct
6 Correct 232 ms 6372 KB Output is correct
7 Correct 213 ms 6344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 134 ms 3868 KB Output isn't correct
2 Halted 0 ms 0 KB -