Submission #98255

# Submission time Handle Problem Language Result Execution time Memory
98255 2019-02-21T17:20:33 Z dalgerok Tarifa (COCI16_tarifa) C++17
50 / 50
3 ms 384 KB
#include<bits/stdc++.h>
#define int long long
using namespace std;




int x, n, p;

main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin >> x >> n;
    int ans = 0;
    for(int i = 1; i <= n; i++){
        cin >> p;
        ans = max(0LL, (ans + x) - p);
    }
    cout << ans + x;
}

Compilation message

tarifa.cpp:10:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct