Submission #799347

# Submission time Handle Problem Language Result Execution time Memory
799347 2023-07-31T13:06:49 Z Tunglam07 Autići (COCI22_autici) C++17
0 / 50
4 ms 840 KB
#include <bits/stdc++.h>
using namespace std;

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin >> n;
	if(n==1)
	{
		cout << 0;
		return 0;
	}
	int sum,a[n+1];
	for(int i=1;i<=n;i++)
	{
		cin >> a[i];
		sum+=a[i];
	}
	sum*=2;
	sum=sum-a[1]-a[n];
	cout << sum;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:22:5: warning: 'sum' may be used uninitialized in this function [-Wmaybe-uninitialized]
   22 |  sum*=2;
      |  ~~~^~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 4 ms 840 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 316 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 4 ms 840 KB Output isn't correct
3 Halted 0 ms 0 KB -