Submission #1041182

#TimeUsernameProblemLanguageResultExecution timeMemory
1041182JerAddk (eJOI21_addk)C++17
0 / 100
1254 ms1696 KiB
#include <bits/stdc++.h> using namespace std; const int MAXN = 100'000; int n, k, q; long long A[MAXN]; int main(){ if(scanf("%d %d", &n, &k)){} for (int i = 0; i < n; i++) if(scanf("%lld", &A[i])){} long t, l, r, m; long long res; if(scanf("%d", &q)){} vector<long long> out; for (int i = 0; i < q; i++){ if(scanf("%ld", &t)){} if (t == (long)2){ if(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++) if(scanf("%ld", &l)){} } for (auto i : out) printf("%lld\n", i); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...