제출 #832185

#제출 시각아이디문제언어결과실행 시간메모리
832185vjudge1Addk (eJOI21_addk)C++17
36 / 100
2064 ms3392 KiB
#include<bits/stdc++.h> using namespace std; const int nmax = 1e5+5; int a[nmax]; long long p[nmax]; int main() { int n,k,q; cin >> n >> k; p[0] = 0; for (int i = 1; i <= n; i++) { cin >> a[i]; p[i] = a[i] + p[i - 1]; } cin >> q; while (q--) { int t; cin >> t; if (t == 1) { int k; cin >> k; } else if (t == 2) { int l, r, m; cin >> l >> r >> m; long long ans = 0; for (int i = l; i <= r; i++) { if (i - l + 1 >= m) { ans += p[i] - p[i - m]; } } cout << ans << endl; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...