Submission #159796

# Submission time Handle Problem Language Result Execution time Memory
159796 2019-10-24T16:23:45 Z Doda Tarifa (COCI16_tarifa) C++
0 / 50
3 ms 504 KB
#include <iostream>
 
using namespace std;
 
int main () {
int x,n,p,a,y;
cin >> y >> n ;
x = y;
for (int i = 0; i<n ; i++){
	cin >> p;
	x = y; 
	x+= a;
	a = 0;
	if (p<x){
		a += x-p ;
	}
}
int q = a+y;

cout << q;
 
return 0;
}

Compilation message

tarifa.cpp: In function 'int main()':
tarifa.cpp:18:5: warning: 'a' may be used uninitialized in this function [-Wmaybe-uninitialized]
 int q = a+y;
     ^
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Incorrect 3 ms 504 KB Output isn't correct
4 Incorrect 2 ms 376 KB Output isn't correct
5 Incorrect 2 ms 376 KB Output isn't correct
6 Incorrect 2 ms 256 KB Output isn't correct
7 Incorrect 2 ms 376 KB Output isn't correct
8 Incorrect 2 ms 376 KB Output isn't correct
9 Incorrect 2 ms 252 KB Output isn't correct
10 Incorrect 2 ms 256 KB Output isn't correct