제출 #475486

#제출 시각아이디문제언어결과실행 시간메모리
475486aris12345678Addk (eJOI21_addk)C++14
0 / 100
633 ms1584 KiB
#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;
}

컴파일 시 표준 에러 (stderr) 메시지

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...