Submission #1034957

# Submission time Handle Problem Language Result Execution time Memory
1034957 2024-07-26T00:22:54 Z christinelynn Addk (eJOI21_addk) C++17
36 / 100
2000 ms 4716 KB
#include <bits/stdc++.h>
typedef long double ld;
#define int long long
#define TC int t; cin >> t; for(int _=1; _<=t; _++)
#define bismillah ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pii pair<int, int>
#define pb push_back
#define mp make_pair
using namespace std;

const int N = 1e5+7;
int a[N], pref[N];

int getsum(int l, int r, int m){
   int ret = 0;
   for(int i=l+m-1, b=l; i<=r; i++, b++){
      ret+=(pref[i]-pref[b-1]);
   }return ret;
}

signed main(){
   bismillah;
   int n, k; cin >> n >> k;
   for(int i=1; i<=n; i++){
      cin >> a[i];
   }
   for(int i=1; i<=n; i++){
      pref[i] = pref[i-1]+a[i];
   }

   int q; cin >> q;
   while(q--){
      int t; cin >> t;
      if(t==1){
         // k=1 > will remain unchanged
         int x; cin >> x;
      }else{
         int l, r, m; cin >> l >> r >> m;
         cout << getsum(l, r, m) << '\n';
      }
   }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 2 ms 476 KB Output is correct
4 Correct 4 ms 600 KB Output is correct
5 Correct 5 ms 604 KB Output is correct
6 Correct 8 ms 664 KB Output is correct
7 Correct 11 ms 600 KB Output is correct
8 Correct 15 ms 604 KB Output is correct
9 Correct 27 ms 860 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 106 ms 1408 KB Output is correct
2 Correct 226 ms 1872 KB Output is correct
3 Correct 397 ms 2388 KB Output is correct
4 Correct 1625 ms 4136 KB Output is correct
5 Execution timed out 2070 ms 4716 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 204 ms 2804 KB Output isn't correct
2 Halted 0 ms 0 KB -