Submission #626069

#TimeUsernameProblemLanguageResultExecution timeMemory
626069BlagojAddk (eJOI21_addk)C++14
0 / 100
1254 ms1176 KiB
#include<bits/stdc++.h> using namespace std; typedef long long int ll; typedef long double ld; int main() { cin.tie(0); cout.tie(0); ios::sync_with_stdio(0); int n, q, k; cin >> n >> k; ll a[n + 1]; for (int i = 1; i <= n; i++) { cin >> a[i]; } cin >> q; int type, l, r, m; ll sum; int p1, p2; while (q--) { cin >> type; if (type == 1) { for (int i = 0; i < k; i++) { cin >> type; } continue; } cin >> l >> r >> m; sum = 0; p1 = 1; for (int i = l; i <= (l + r) / 2; i++) { sum += a[i] * min(p1, m); p1++; } p1 = 1; for (int i = r; i > (l + r) / 2; i--) { sum += a[i] * min(p1, m); p1++; } cout << sum << "\n"; } }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:20:13: warning: unused variable 'p2' [-Wunused-variable]
   20 |     int p1, p2;
      |             ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...