Submission #1071426

#TimeUsernameProblemLanguageResultExecution timeMemory
1071426vjudge1Addk (eJOI21_addk)C++17
36 / 100
2061 ms1508 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define pb push_back #define sz(x) x.size() #define nl '\n' #define F first #define S second const int N = 1e6 + 1; const int inf = 1e18; signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, k, q; cin >>n >>k; int a[n + 1]; for( int i = 1; i <= n; ++i ) cin >>a[i]; cin >>q; while( q-- ) { int t, L, R, m, x; cin >> t; if (t == 1) { cin >>x; continue; } else { cin >>L >>R >>m; int sum = 0, res = 0; for( int l = L, r = L; r <= R; ++r ) { sum += a[r]; while( r - l + 1 > m ) { sum -= a[l]; ++l; } if( r - l + 1 == m ) res += sum; } cout <<res <<nl; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...