답안 #365723

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
365723 2021-02-12T09:20:22 Z kostia244 Ice Hockey World Championship (CEOI15_bobek) C++17
100 / 100
503 ms 8692 KB
#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("avx,avx2,sse,sse2")
#include<bits/stdc++.h>
#define all(x) begin(x), end(x)
using namespace std;
using ll = long long;
int n;
ll w, a[44];
int main() {
	cin.tie(0)->sync_with_stdio(0);
	//multitest([&](){});
	cin >> n >> w;
	vector<ll> cn;
	for(int i = 0; i < n; i++) cin >> a[i];
	int c = n/2;
	int b = n - c;
	for(int i = 0; i < 1<<c; i++) {
		ll cur = 0;
		for(int j = 0; j < c; j++) if((i>>j)&1) cur += a[j];
		cn.push_back(cur);
	}
	ll ans = 0;
	sort(all(cn));
	for(int i = 0; i < 1<<b; i++) {
		ll cur = 0;
		for(int j = 0; j < b; j++) if((i>>j)&1) cur += a[c+j];
		ans += upper_bound(all(cn), w-cur)-cn.begin();
	}
	cout << ans << '\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 26 ms 1008 KB Output is correct
2 Correct 92 ms 2544 KB Output is correct
3 Correct 483 ms 8672 KB Output is correct
4 Correct 88 ms 2536 KB Output is correct
5 Correct 12 ms 1008 KB Output is correct
6 Correct 6 ms 752 KB Output is correct
7 Correct 12 ms 1008 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 38 ms 1516 KB Output is correct
2 Correct 29 ms 1008 KB Output is correct
3 Correct 184 ms 4580 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 6 ms 880 KB Output is correct
6 Correct 12 ms 1008 KB Output is correct
7 Correct 12 ms 1008 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 62 ms 1516 KB Output is correct
2 Correct 143 ms 2536 KB Output is correct
3 Correct 137 ms 2536 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 62 ms 2536 KB Output is correct
6 Correct 203 ms 8672 KB Output is correct
7 Correct 73 ms 2536 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 320 ms 4580 KB Output is correct
2 Correct 25 ms 1008 KB Output is correct
3 Correct 9 ms 752 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 7 ms 752 KB Output is correct
6 Correct 140 ms 4580 KB Output is correct
7 Correct 12 ms 1008 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 28 ms 1008 KB Output is correct
2 Correct 86 ms 2536 KB Output is correct
3 Correct 7 ms 752 KB Output is correct
4 Correct 8 ms 752 KB Output is correct
5 Correct 76 ms 2536 KB Output is correct
6 Correct 15 ms 1008 KB Output is correct
7 Correct 231 ms 8672 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 364 ms 8692 KB Output is correct
2 Correct 29 ms 1008 KB Output is correct
3 Correct 9 ms 752 KB Output is correct
4 Correct 503 ms 8672 KB Output is correct
5 Correct 101 ms 4580 KB Output is correct
6 Correct 12 ms 1008 KB Output is correct
7 Correct 24 ms 1516 KB Output is correct