Submission #1329118

#TimeUsernameProblemLanguageResultExecution timeMemory
1329118alinurSecret (JOI14_secret)C++17
0 / 100
341 ms4428 KiB
#include "secret.h"
#include <bits/stdc++.h>
#define ll long long

using namespace std;

ll a[1001], pref[1001], b[1001];
ll mod = 1e9;
void Init(int N, int A[]) {
    int n = N;
    pref[0] = 0;
    for (int i = 1; i <= n; i++) a[i] = A[i - 1], b[i] = a[i] % 2, a[i] -= a[i] % 2, pref[i] = pref[i - 1] + a[i];
}

int Query(int L, int R) {
  L++, R++;
  ll x = pref[R] - pref[L - 1] + b[L];
  x %= mod;
  if (x == 0) x = mod;
  return x;
}
#Verdict Execution timeMemoryGrader output
Fetching results...