Submission #64504

# Submission time Handle Problem Language Result Execution time Memory
64504 2018-08-04T16:42:44 Z theknife2001 Tarifa (COCI16_tarifa) C++17
50 / 50
4 ms 520 KB
#include<bits/stdc++.h>


using namespace std;


int main()
{
  int x;
  cin>>x;
  int n;
  cin>>n;
  int a;
  int last=0;
  for(int i=0;i<n;i++)
  {
   	cin>>a;
    last+=x;
    last-=a;
    last=max(last,0);
  }
  cout<<last+x<<endl;
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 3 ms 360 KB Output is correct
3 Correct 3 ms 496 KB Output is correct
4 Correct 4 ms 496 KB Output is correct
5 Correct 3 ms 496 KB Output is correct
6 Correct 2 ms 496 KB Output is correct
7 Correct 3 ms 496 KB Output is correct
8 Correct 3 ms 496 KB Output is correct
9 Correct 3 ms 520 KB Output is correct
10 Correct 2 ms 520 KB Output is correct