Submission #1132934

#TimeUsernameProblemLanguageResultExecution timeMemory
1132934lopkusSecret (JOI14_secret)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>

#define int long long

using namespace std;
/*
int ask(int x, int y) {
    return min(x + 2 * (y / 2), (int)1e9);
}
*/
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> a(n + 1);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    int q;
    cin >> q;
    while(q--) {
        int l, r;
        cin >> l >> r;
        int ans = a[l];
        for(int i = l + 1; i <= r; i++) {
            ans = ask(ans, a[i]);
        }
        cout << ans << "\n";
    }
}

Compilation message (stderr)

secret.cpp: In function 'int main()':
secret.cpp:27:19: error: 'ask' was not declared in this scope
   27 |             ans = ask(ans, a[i]);
      |                   ^~~