Submission #626053

# Submission time Handle Problem Language Result Execution time Memory
626053 2022-08-11T07:33:08 Z Blagoj Addk (eJOI21_addk) C++14
0 / 100
1322 ms 2848 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;
    int a[n + 1];
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i];
    }
    cin >> q;
    int type, l, r, m;
    ll sum;
    int turn = 0, p1, p2;
    while (q--)
    {
        cin >> type;
        if (type == 1)
        {
            for (int i = 0; i < k; i++)
            {
                cin >> type;
            }
            continue;
        }
        cin >> l >> r >> m;
        sum = 0;
        p1 = l, p2 = r;
        while (p1 <= p2)
        {
            sum += a[p1] * min((p1 - l + 1), m);
            p1++;
            if (p1 > p2)
            {
                break;
            }
            sum += a[p2] * min((r - p2 + 1), m);
            p2--;
        }
        cout << sum << "\n";
    }
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:20:9: warning: unused variable 'turn' [-Wunused-variable]
   20 |     int turn = 0, p1, p2;
      |         ^~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 280 ms 1128 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1322 ms 2848 KB Output isn't correct
2 Halted 0 ms 0 KB -