답안 #380375

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
380375 2021-03-21T07:46:43 Z ritul_kr_singh Ice Hockey World Championship (CEOI15_bobek) C++17
100 / 100
503 ms 29020 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define sp << ' ' <<
#define nl << '\n'

vector<int> create(vector<int> a, bool sorted){
	int n = a.size();
	const int LIM = 1<<n;
	int sum[LIM] = {0};
	vector<int> res = {0};
	for(int i=1; i<LIM; ++i){
		int last = 0;
		for(int j=0; j<n; ++j) if((1<<j)&i) last = j;
		sum[i] = sum[i^(1<<last)] + a[last];
		res.push_back(sum[i]);
	}
	if(sorted) sort(res.begin(), res.end());
	return res;
}
 
signed main(){
	ios_base::sync_with_stdio(false); cin.tie(nullptr);
	int n, m; cin >> n >> m;
	vector<int> a(n/2), b(n-n/2);
	for(int i=0; i<n/2; ++i) cin >> a[i];
	for(int i=n/2; i<n; ++i) cin >> b[i-n/2];
	vector<int> c = create(a, false), d = create(b, true);
	int ans = 0;
	for(int i : c){
		if(i<=m){
			auto f = upper_bound(d.begin(), d.end(), m-i);
			ans += f-d.begin();
		}
	}
	cout << ans;
}
# 결과 실행 시간 메모리 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 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 3056 KB Output is correct
2 Correct 84 ms 7524 KB Output is correct
3 Correct 503 ms 29008 KB Output is correct
4 Correct 86 ms 7524 KB Output is correct
5 Correct 10 ms 2156 KB Output is correct
6 Correct 5 ms 1264 KB Output is correct
7 Correct 10 ms 2156 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 35 ms 3944 KB Output is correct
2 Correct 26 ms 3056 KB Output is correct
3 Correct 158 ms 14688 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 6 ms 1264 KB Output is correct
6 Correct 10 ms 2156 KB Output is correct
7 Correct 9 ms 2156 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 51 ms 5612 KB Output is correct
2 Correct 121 ms 10728 KB Output is correct
3 Correct 125 ms 10756 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 53 ms 10728 KB Output is correct
6 Correct 175 ms 29020 KB Output is correct
7 Correct 70 ms 10728 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 297 ms 20960 KB Output is correct
2 Correct 23 ms 3056 KB Output is correct
3 Correct 8 ms 1264 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 5 ms 1264 KB Output is correct
6 Correct 158 ms 20960 KB Output is correct
7 Correct 9 ms 2156 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 3056 KB Output is correct
2 Correct 80 ms 7652 KB Output is correct
3 Correct 8 ms 1264 KB Output is correct
4 Correct 8 ms 1264 KB Output is correct
5 Correct 68 ms 10728 KB Output is correct
6 Correct 17 ms 3056 KB Output is correct
7 Correct 160 ms 29008 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 330 ms 29008 KB Output is correct
2 Correct 26 ms 3056 KB Output is correct
3 Correct 8 ms 1264 KB Output is correct
4 Correct 493 ms 29008 KB Output is correct
5 Correct 86 ms 14688 KB Output is correct
6 Correct 10 ms 2156 KB Output is correct
7 Correct 18 ms 3944 KB Output is correct