Submission #475241

#TimeUsernameProblemLanguageResultExecution timeMemory
475241aris12345678Addk (eJOI21_addk)C++14
0 / 100
408 ms2508 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 %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 (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 %d %d %d", &type, &l, &r, &m);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...