답안 #533296

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
533296 2022-03-05T10:04:29 Z ddy888 Ice Hockey World Championship (CEOI15_bobek) C++17
100 / 100
509 ms 16708 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]
   12 |  scanf("%d%lld",&N,&M);
      |  ~~~~~^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 0 ms 296 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 300 KB Output is correct
7 Correct 1 ms 252 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 320 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 30 ms 1816 KB Output is correct
2 Correct 88 ms 4404 KB Output is correct
3 Correct 509 ms 16708 KB Output is correct
4 Correct 89 ms 4408 KB Output is correct
5 Correct 12 ms 1324 KB Output is correct
6 Correct 6 ms 808 KB Output is correct
7 Correct 13 ms 1356 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 40 ms 2288 KB Output is correct
2 Correct 31 ms 1856 KB Output is correct
3 Correct 186 ms 8460 KB Output is correct
4 Correct 0 ms 296 KB Output is correct
5 Correct 6 ms 844 KB Output is correct
6 Correct 12 ms 1360 KB Output is correct
7 Correct 12 ms 1356 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 61 ms 3268 KB Output is correct
2 Correct 152 ms 6364 KB Output is correct
3 Correct 143 ms 6460 KB Output is correct
4 Correct 1 ms 304 KB Output is correct
5 Correct 71 ms 6352 KB Output is correct
6 Correct 210 ms 16696 KB Output is correct
7 Correct 83 ms 6436 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 316 ms 12608 KB Output is correct
2 Correct 26 ms 1856 KB Output is correct
3 Correct 10 ms 844 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 6 ms 768 KB Output is correct
6 Correct 158 ms 12608 KB Output is correct
7 Correct 14 ms 1356 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 30 ms 1804 KB Output is correct
2 Correct 84 ms 4364 KB Output is correct
3 Correct 9 ms 756 KB Output is correct
4 Correct 10 ms 844 KB Output is correct
5 Correct 86 ms 6432 KB Output is correct
6 Correct 18 ms 1868 KB Output is correct
7 Correct 251 ms 16616 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 374 ms 16696 KB Output is correct
2 Correct 31 ms 1868 KB Output is correct
3 Correct 9 ms 840 KB Output is correct
4 Correct 485 ms 16708 KB Output is correct
5 Correct 110 ms 8516 KB Output is correct
6 Correct 13 ms 1340 KB Output is correct
7 Correct 27 ms 2296 KB Output is correct