Submission #1041179

#TimeUsernameProblemLanguageResultExecution timeMemory
1041179JerAddk (eJOI21_addk)C++17
0 / 100
1257 ms3520 KiB
#include <bits/stdc++.h> using namespace std; const int MAXN = 100'000; int n, k, q; long long A[MAXN]; int main(){ scanf("%d %d", &n, &k); for (int i = 0; i < n; i++) scanf("%lld", &A[i]); long t, l, r, m; long long res; scanf("%d", &q); vector<long long> out; for (int i = 0; i < q; i++){ scanf("%ld", &t); if (t == (long)2){ scanf("%ld %ld %ld", &l, &r, &m); res = 0, r--, l--; for (int i = l; i <= r; i++) res += (min({m - 1, i - l, r - i + 1}) + ((r - i + 1) >= m)) * A[i]; out.push_back(res); } else for (int i = 0; i < k; i++) scanf("%ld", &l); } for (auto i : out) printf("%lld\n", i); return 0; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     scanf("%d %d", &n, &k);
      |     ~~~~~^~~~~~~~~~~~~~~~~
Main.cpp:13:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |         scanf("%lld", &A[i]);
      |         ~~~~~^~~~~~~~~~~~~~~
Main.cpp:18:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |     scanf("%d", &q);
      |     ~~~~~^~~~~~~~~~
Main.cpp:21:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |         scanf("%ld", &t);
      |         ~~~~~^~~~~~~~~~~
Main.cpp:24:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |             scanf("%ld %ld %ld", &l, &r, &m);
      |             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:33:22: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   33 |                 scanf("%ld", &l);
      |                 ~~~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...