답안 #170196

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
170196 2019-12-24T08:19:04 Z banterbry Ice Hockey World Championship (CEOI15_bobek) C++17
100 / 100
559 ms 16896 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
typedef pair<int,int> pi;

int N;
ll M,A1[1<<20],A2[1<<20],v1[1<<20],v2[1<<20];

int main() {
	scanf("%d%lld",&N,&M);
	int t = N/2;
	N -= t;
	for (int i = 0; i < N; i++) cin >> A1[i];
	for (int i = 0; i < t; i++) cin >> A2[i];
	for (int i = 0; i < (1<<N); i++) {
		for (int j = 0; j < N; j++) {
			if (i&(1<<j)) v1[i] += A1[j];
		}
	}
	for (int i = 0; i < (1<<t); i++) {
		for (int j = 0; j < t; j++) {
			if (i&(1<<j)) v2[i] += A2[j];
		}
	}
	sort(v2,v2+(1<<t));
	ll ans = 0;
	for (int i = 0; i < (1<<N); i++) {
		ll tmp = M- v1[i];
		ans += upper_bound(v2,v2+(1<<t),tmp)-v2;
	}
	printf("%lld",ans);
	return 0;
}

Compilation message

bobek.cpp: In function 'int main()':
bobek.cpp:12:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%lld",&N,&M);
  ~~~~~^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 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 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 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 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 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 2 ms 376 KB Output is correct
6 Correct 2 ms 504 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 38 ms 2040 KB Output is correct
2 Correct 121 ms 4492 KB Output is correct
3 Correct 559 ms 16896 KB Output is correct
4 Correct 119 ms 4492 KB Output is correct
5 Correct 17 ms 1400 KB Output is correct
6 Correct 9 ms 888 KB Output is correct
7 Correct 17 ms 1400 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 51 ms 2424 KB Output is correct
2 Correct 38 ms 1916 KB Output is correct
3 Correct 231 ms 8604 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 8 ms 888 KB Output is correct
6 Correct 18 ms 1400 KB Output is correct
7 Correct 17 ms 1404 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 75 ms 3448 KB Output is correct
2 Correct 194 ms 6520 KB Output is correct
3 Correct 197 ms 6548 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 90 ms 6520 KB Output is correct
6 Correct 295 ms 16852 KB Output is correct
7 Correct 93 ms 6520 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 409 ms 12764 KB Output is correct
2 Correct 35 ms 1912 KB Output is correct
3 Correct 13 ms 888 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 9 ms 916 KB Output is correct
6 Correct 222 ms 12740 KB Output is correct
7 Correct 17 ms 1400 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 38 ms 1940 KB Output is correct
2 Correct 115 ms 4500 KB Output is correct
3 Correct 12 ms 888 KB Output is correct
4 Correct 12 ms 888 KB Output is correct
5 Correct 104 ms 6520 KB Output is correct
6 Correct 25 ms 1912 KB Output is correct
7 Correct 292 ms 16800 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 456 ms 16800 KB Output is correct
2 Correct 42 ms 1912 KB Output is correct
3 Correct 12 ms 888 KB Output is correct
4 Correct 558 ms 16748 KB Output is correct
5 Correct 127 ms 8568 KB Output is correct
6 Correct 18 ms 1400 KB Output is correct
7 Correct 33 ms 2424 KB Output is correct