Submission #626075

# Submission time Handle Problem Language Result Execution time Memory
626075 2022-08-11T07:50:16 Z Blagoj Addk (eJOI21_addk) C++14
36 / 100
2000 ms 2788 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
int main()
{
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(0);
    int n, q, k;
    cin >> n >> k;
    ll a[n + 1];
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    cin >> q;
    int type, l, r, m;
    ll sum;
    int p1;
    while (q--)
    {
        cin >> type;
        if (type == 1)
        {
            for (int i = 0; i < k; i++)
            {
                cin >> type;
            }
            continue;
        }
        cin >> l >> r >> m;
        l--;
        r--;
        sum = 0;
        p1 = 1;
        int mm = min(r - l + 1 - m + 1, m);
        for (int i = l; i < (l + r) / 2; i++)
        {
            sum += a[i] * min(p1, mm);
            p1++;
        }
        p1 = 1;
        for (int i = r; i >= (l + r) / 2; i--)
        {
            sum += a[i] * min(p1, mm);
            p1++;
        }
        cout << sum << "\n";
    }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 3 ms 340 KB Output is correct
3 Correct 7 ms 376 KB Output is correct
4 Correct 9 ms 452 KB Output is correct
5 Correct 15 ms 480 KB Output is correct
6 Correct 30 ms 512 KB Output is correct
7 Correct 43 ms 564 KB Output is correct
8 Correct 44 ms 592 KB Output is correct
9 Correct 95 ms 648 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 447 ms 620 KB Output is correct
2 Correct 847 ms 1672 KB Output is correct
3 Correct 1314 ms 2208 KB Output is correct
4 Execution timed out 2024 ms 2788 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1619 ms 1196 KB Output isn't correct
2 Halted 0 ms 0 KB -