Submission #1036010

# Submission time Handle Problem Language Result Execution time Memory
1036010 2024-07-27T01:43:52 Z devariaota Addk (eJOI21_addk) C++17
0 / 100
162 ms 2404 KB
#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;
  ll maks = 0;
  while (q--) {
    ll mode,l,r,m; cin>>mode>>l>>r>>m;
    if (mode == 1) continue;
    ll ans = 0, re = l + m - 1;
    while (re <= r) {
      ans += (pref[re] - pref[l-1]);
      l++;
      re++;
    }
    cout<<ans;
    if (q > 1) cout<<endl;
  }
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:18:6: warning: unused variable 'maks' [-Wunused-variable]
   18 |   ll maks = 0;
      |      ^~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 75 ms 1308 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 162 ms 2404 KB Output isn't correct
2 Halted 0 ms 0 KB -