Submission #1299703

#TimeUsernameProblemLanguageResultExecution timeMemory
1299703tabTarifa (COCI16_tarifa)C++20
50 / 50
1 ms576 KiB
#include "bits/stdc++.h"
using namespace std;
#define intt long long
#define fi first
#define se second

const intt mxN = 2e5 + 5;
const intt LG = 20;
const intt inf = 1e18;  

intt x, n;

void _() {
    cin >> x >> n;
    intt cur = x;
    for(intt i = 0; i < n; i++) {
        intt v;
        cin >> v;
        cur = x + (cur - v);
        cur = max(cur, x);
    }
    cout << cur << endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    intt t = 1, buu = 1;
    // cin >> t;
    while(t--){
        // cout << "Case #" << buu++ << ": ";
        _();
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...