답안 #475241

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
475241 2021-09-21T15:27:34 Z aris12345678 Addk (eJOI21_addk) C++14
0 / 100
408 ms 2508 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 %d %d %d", &type, &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 %d %d %d", &type, &l, &r, &m);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 166 ms 632 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 408 ms 2508 KB Output isn't correct
2 Halted 0 ms 0 KB -