Submission #164503

# Submission time Handle Problem Language Result Execution time Memory
164503 2019-11-21T07:33:20 Z Muhammetali Bootfall (IZhO17_bootfall) C++11
6 / 100
1000 ms 480 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,a[1001],b[1001],c[1001],g1,g2,i;
vector<ll>v;
bool f(ll barla[])
{
	for (i=0;i<n;i++) b[i]=0;
	for (;;)
	{
		for (i=n;i>0;i--)
		{
			if (b[i]==1) b[i]=0;
			else
			{
				b[i]++;
				break;
			}
		}
		if (i==0) break;
		g1=0;
		g2=0;
		for (i=1;i<=n;i++)
		{
			if (b[i]==0) g1+=barla[i-1];
			else g2+=barla[i-1];
		}
		if (g1==g2) return true;
	}
	return false;
}
int main()
{
	cin >> n;
	ll mx=0;
	for  (ll i=0;i<n;i++)
	{
		cin >> a[i];
		mx+=a[i];
	}
	if (f(a)==false) return cout << 0,0;
	for (ll i=1;i<=mx;i++)
	{
		ll bar=0;
		for (ll j=0;j<n;j++)
		{
			for (ll k=0;k<n;k++)c[k]=a[k];
			c[j]=i;
			if (f(c)==false)
			{
				bar=1;
				break;
			}
		}
		if (bar==0)
		{
			v.push_back(i);
		}
	}
	cout << v.size() << "\n";
	for (ll i=0;i<v.size();i++)
	{
		cout << v[i] << " ";
	}
}

Compilation message

bootfall.cpp: In function 'int main()':
bootfall.cpp:61:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (ll i=0;i<v.size();i++)
              ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 247 ms 376 KB Output is correct
6 Correct 3 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 401 ms 480 KB Output is correct
9 Correct 35 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 247 ms 376 KB Output is correct
6 Correct 3 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 401 ms 480 KB Output is correct
9 Correct 35 ms 376 KB Output is correct
10 Execution timed out 1063 ms 376 KB Time limit exceeded
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 247 ms 376 KB Output is correct
6 Correct 3 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 401 ms 480 KB Output is correct
9 Correct 35 ms 376 KB Output is correct
10 Execution timed out 1063 ms 376 KB Time limit exceeded
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 247 ms 376 KB Output is correct
6 Correct 3 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 401 ms 480 KB Output is correct
9 Correct 35 ms 376 KB Output is correct
10 Execution timed out 1063 ms 376 KB Time limit exceeded
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 247 ms 376 KB Output is correct
6 Correct 3 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 401 ms 480 KB Output is correct
9 Correct 35 ms 376 KB Output is correct
10 Execution timed out 1063 ms 376 KB Time limit exceeded
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 247 ms 376 KB Output is correct
6 Correct 3 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 401 ms 480 KB Output is correct
9 Correct 35 ms 376 KB Output is correct
10 Execution timed out 1063 ms 376 KB Time limit exceeded
11 Halted 0 ms 0 KB -