Submission #1071624

#TimeUsernameProblemLanguageResultExecution timeMemory
1071624vjudge1Addk (eJOI21_addk)C++17
0 / 100
2072 ms604 KiB
#include<bits/stdc++.h> using namespace std; #define int unsigned long long #define nn "\n"; #define pb push_back const int N = 2e5 + 8 , inf = 1e17 ; int n , k , a[N] ,q ; signed main() { ios_base::sync_with_stdio(0), cin.tie(0); cin>> n >> k ; for(int i= 1 ; i <= n ; i++){ cin>> a[i]; } cin>> q ; while(q--){ int h , l , r , m ; cin>> h ; if(h == 1 ){ int x ; cin>> x ; } else { cin >> l >> r >> m; int sum = 0 , ans =0 ; int j = 1; int go = l ; while(go+m <= r){ for(int i = go ; i <= go+m; i++)ans+=a[i]; go++; } while (l < r) { sum += (a[l] * j) + (a[r] * j); l++; r--; j = min(j + 1 , m ); } if (l == r) { sum += a[l] * j; } cout << ans << nn } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...