# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1036030 | makanhulia | Addk (eJOI21_addk) | C++17 | 1207 ms | 5716 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define nikah ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
const ll maxn = 1e5+7;
using namespace std;
ll n,q,k;
ll a[maxn], pref[maxn];
int main() {
nikah
cin>>n>>k;
for (ll i=1; i<=n; i++) {
cin>>a[i];
pref[i] = a[i] + pref[i-1];
}
cin>>q;
while (q--) {
ll mode; cin>>mode;
if (mode == 2) {
ll l,r,m; cin>>l>>r>>m;
ll ans = 0;
m = min(m, r-l+2-m);
for (ll i=1; i<=m; i++) {
ans += (pref[r] - pref[l-1]);
l++; r--;
}
cout<<ans<<endl;
} else {
ll x; cin>>x;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |