답안 #1005003

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1005003 2024-06-22T06:03:03 Z Muaath_5 Ice Hockey World Championship (CEOI15_bobek) C++17
100 / 100
359 ms 10360 KB
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int, int>
using namespace std;

const int N = 2e5+1;

int n;
ll m, a[N];

int main()
{
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	cin >> n >> m;
	for (int i = 0; i < n; cin >> a[i++]);
	vector<ll> sums;
	for (int msk = 0; msk < (1 << (n/2)); msk++) {
		ll sum = 0;
		for (int i = 0; i < n/2; i++) {
			if (msk>>i&1) {
				sum += a[i];
			}
		}
		sums.push_back(sum);
	}
	sort(sums.begin(), sums.end());
	ll sol = 0;
	for (int msk = 0; msk < (1 << (n/2 + n%2)); msk++) {
		ll sum = 0;
		for (int i = 0; i < n/2+n%2; i++) {
			if (msk>>i&1) {
				sum += a[n/2+i];
			}
		}
		if (sum > m) continue;
		int idx = upper_bound(sums.begin(), sums.end(), m-sum)-sums.begin();
		assert(sum + sums[idx - 1] <= m);
		sol += idx;
	}
	cout << sol;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 352 KB Output is correct
6 Correct 0 ms 352 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 352 KB Output is correct
3 Correct 0 ms 352 KB Output is correct
4 Correct 0 ms 352 KB Output is correct
5 Correct 0 ms 356 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 23 ms 992 KB Output is correct
2 Correct 78 ms 2524 KB Output is correct
3 Correct 359 ms 10180 KB Output is correct
4 Correct 78 ms 2776 KB Output is correct
5 Correct 11 ms 1000 KB Output is correct
6 Correct 6 ms 868 KB Output is correct
7 Correct 11 ms 1000 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 33 ms 1508 KB Output is correct
2 Correct 25 ms 988 KB Output is correct
3 Correct 151 ms 6352 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 5 ms 860 KB Output is correct
6 Correct 12 ms 992 KB Output is correct
7 Correct 11 ms 992 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 53 ms 1496 KB Output is correct
2 Correct 124 ms 2520 KB Output is correct
3 Correct 116 ms 2520 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 63 ms 2608 KB Output is correct
6 Correct 183 ms 10360 KB Output is correct
7 Correct 57 ms 2516 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 283 ms 5228 KB Output is correct
2 Correct 22 ms 992 KB Output is correct
3 Correct 8 ms 860 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 6 ms 860 KB Output is correct
6 Correct 139 ms 5604 KB Output is correct
7 Correct 11 ms 988 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 26 ms 992 KB Output is correct
2 Correct 74 ms 2544 KB Output is correct
3 Correct 7 ms 732 KB Output is correct
4 Correct 7 ms 860 KB Output is correct
5 Correct 76 ms 2552 KB Output is correct
6 Correct 16 ms 992 KB Output is correct
7 Correct 178 ms 10296 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 275 ms 9664 KB Output is correct
2 Correct 26 ms 988 KB Output is correct
3 Correct 8 ms 860 KB Output is correct
4 Correct 356 ms 9432 KB Output is correct
5 Correct 96 ms 5564 KB Output is correct
6 Correct 12 ms 1244 KB Output is correct
7 Correct 22 ms 1500 KB Output is correct