Submission #40516

# Submission time Handle Problem Language Result Execution time Memory
40516 2018-02-03T14:53:16 Z Pajaraja Ice Hockey World Championship (CEOI15_bobek) C++14
50 / 100
572 ms 8816 KB
#include <bits/stdc++.h>
using namespace std;
long long a[40],c[2000000];
long long binarna(int l,int r,long long val)
{
	if(l==r) return l;
	int s=(l+r)/2;
	if(c[s]>val) return binarna(l,s,val);
	return binarna(s+1,r,val);
}
int main()
{
	int n;
	long long m,sol=0;
	scanf("%d %lld",&n,&m);
	for(int i=0;i<n;i++) scanf("%d",&a[i]);
	int p=n/2;
	for(int i=0;i<(1<<p);i++)
	{
		int ma=i;
		long long pr=0;
		for(int j=0;j<p;j++)
		{
			if(ma%2==0) pr+=a[j];
			ma/=2;
		}
		c[i]=pr;
	}
	c[1<<p]=2000000000000000000LL;
	sort(c,c+(1<<p)+1);
	int q=n-p;
	for(int i=0;i<(1<<q);i++)
	{
		int ma=i;
		long long pr=0;
		for(int j=0;j<q;j++)
		{
			if(ma%2==0) pr+=a[p+j];
			ma/=2;
		}
		sol+=binarna(0,(1<<p),m-pr);
	}
	printf("%lld",sol);
}

Compilation message

bobek.cpp: In function 'int main()':
bobek.cpp:16:39: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long long int*' [-Wformat=]
  for(int i=0;i<n;i++) scanf("%d",&a[i]);
                                       ^
bobek.cpp:15:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %lld",&n,&m);
                        ^
bobek.cpp:16:40: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=0;i<n;i++) scanf("%d",&a[i]);
                                        ^
# Verdict Execution time Memory Grader output
1 Correct 1 ms 248 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 352 KB Output is correct
2 Correct 2 ms 552 KB Output is correct
3 Correct 1 ms 552 KB Output is correct
4 Correct 2 ms 552 KB Output is correct
5 Correct 2 ms 676 KB Output is correct
6 Correct 1 ms 676 KB Output is correct
7 Correct 2 ms 676 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 676 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 676 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 40 ms 988 KB Output is correct
2 Correct 151 ms 2524 KB Output is correct
3 Correct 572 ms 8800 KB Output is correct
4 Correct 123 ms 8800 KB Output is correct
5 Correct 19 ms 8800 KB Output is correct
6 Correct 10 ms 8800 KB Output is correct
7 Correct 18 ms 8800 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 53 ms 8800 KB Output is correct
2 Correct 41 ms 8800 KB Output is correct
3 Correct 243 ms 8800 KB Output is correct
4 Correct 2 ms 8800 KB Output is correct
5 Correct 9 ms 8800 KB Output is correct
6 Correct 19 ms 8800 KB Output is correct
7 Correct 18 ms 8800 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 90 ms 8800 KB Output is correct
2 Correct 217 ms 8800 KB Output is correct
3 Correct 201 ms 8800 KB Output is correct
4 Correct 1 ms 8800 KB Output is correct
5 Correct 105 ms 8800 KB Output is correct
6 Correct 317 ms 8816 KB Output is correct
7 Correct 102 ms 8816 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 242 ms 8816 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 8816 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 339 ms 8816 KB Output isn't correct
2 Halted 0 ms 0 KB -