Submission #475486

# Submission time Handle Problem Language Result Execution time Memory
475486 2021-09-22T16:50:03 Z aris12345678 Addk (eJOI21_addk) C++14
0 / 100
633 ms 1584 KB
#include <bits/stdc++.h>
using namespace std;

const int mxN = 100005;
int a[mxN];

int main() {
    int n, k, q;
    scanf("%d %d", &n, &k);
    for(int i = 1; i <= n; i++)
        scanf("%d", &a[i]);
    scanf("%d", &q);
    while(q--) {
        int type, l, r, m;
        scanf("%d", &type);
        if(type == 1) {
            scanf("%d", &l);
            continue;
        }
        scanf("%d %d %d", &l, &r, &m);
        int cc = 1, i = l, j = r;
        long long ans = 0;
        while(i <= j) {
            ans += a[i++]*cc, ans += a[j--]*cc;
            cc = min(cc+1, m);
        }
        printf("%lld\n", ans);
    }
    return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     scanf("%d %d", &n, &k);
      |     ~~~~~^~~~~~~~~~~~~~~~~
Main.cpp:11:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |         scanf("%d", &a[i]);
      |         ~~~~~^~~~~~~~~~~~~
Main.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |     scanf("%d", &q);
      |     ~~~~~^~~~~~~~~~
Main.cpp:15:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |         scanf("%d", &type);
      |         ~~~~~^~~~~~~~~~~~~
Main.cpp:17:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |             scanf("%d", &l);
      |             ~~~~~^~~~~~~~~~
Main.cpp:20:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |         scanf("%d %d %d", &l, &r, &m);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 322 ms 860 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 633 ms 1584 KB Output isn't correct
2 Halted 0 ms 0 KB -