답안 #40514

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
40514 2018-02-03T14:48:23 Z Pajaraja Ice Hockey World Championship (CEOI15_bobek) C++14
50 / 100
562 ms 9056 KB
#include <bits/stdc++.h>
using namespace std;
long long a[40],c[2000000];
int 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]=1000000000000000000LL;
	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:23: 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]);
                                        ^
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 356 KB Output is correct
2 Correct 1 ms 432 KB Output is correct
3 Correct 1 ms 452 KB Output is correct
4 Correct 3 ms 452 KB Output is correct
5 Correct 1 ms 452 KB Output is correct
6 Correct 2 ms 452 KB Output is correct
7 Correct 2 ms 452 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 508 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 568 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 38 ms 1028 KB Output is correct
2 Correct 131 ms 2692 KB Output is correct
3 Correct 562 ms 8848 KB Output is correct
4 Correct 122 ms 8848 KB Output is correct
5 Correct 20 ms 8848 KB Output is correct
6 Correct 10 ms 8848 KB Output is correct
7 Correct 18 ms 8848 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 53 ms 8848 KB Output is correct
2 Correct 42 ms 8848 KB Output is correct
3 Correct 255 ms 8848 KB Output is correct
4 Correct 2 ms 8848 KB Output is correct
5 Correct 10 ms 8848 KB Output is correct
6 Correct 20 ms 8848 KB Output is correct
7 Correct 20 ms 8848 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 90 ms 8848 KB Output is correct
2 Correct 206 ms 8848 KB Output is correct
3 Correct 199 ms 8848 KB Output is correct
4 Correct 2 ms 8848 KB Output is correct
5 Correct 104 ms 8848 KB Output is correct
6 Correct 330 ms 9056 KB Output is correct
7 Correct 111 ms 9056 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 235 ms 9056 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 27 ms 9056 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 340 ms 9056 KB Output isn't correct
2 Halted 0 ms 0 KB -