Submission #1071426

# Submission time Handle Problem Language Result Execution time Memory
1071426 2024-08-23T07:18:35 Z vjudge1 Addk (eJOI21_addk) C++17
36 / 100
2000 ms 1508 KB
#include <bits/stdc++.h>

using namespace std;

#define int long long
#define pb push_back
#define sz(x) x.size()
#define nl '\n'
#define F first
#define S second

const int N = 1e6 + 1;
const int inf = 1e18;

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n, k, q;
    cin >>n >>k;
    int a[n + 1];
    for( int i = 1; i <= n; ++i )
        cin >>a[i];
    cin >>q;
    while( q-- )
    {
        int t, L, R, m, x;
        cin >> t;
        if (t == 1)
        {
            cin >>x;
            continue;
        }
        else
        {
            cin >>L >>R >>m;
            int sum = 0, res = 0;
            for( int l = L, r = L; r <= R; ++r )
            {
                sum += a[r];
                while( r - l + 1 > m )
                {
                    sum -= a[l];
                    ++l;
                }
                if( r - l + 1 == m )
                    res += sum;
            }
            cout <<res <<nl;
        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 4 ms 348 KB Output is correct
4 Correct 8 ms 348 KB Output is correct
5 Correct 20 ms 524 KB Output is correct
6 Correct 26 ms 596 KB Output is correct
7 Correct 30 ms 348 KB Output is correct
8 Correct 41 ms 348 KB Output is correct
9 Correct 80 ms 592 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 321 ms 620 KB Output is correct
2 Correct 714 ms 948 KB Output is correct
3 Correct 1257 ms 1108 KB Output is correct
4 Execution timed out 2061 ms 1508 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 632 ms 1180 KB Output isn't correct
2 Halted 0 ms 0 KB -