답안 #218306

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
218306 2020-04-01T23:33:28 Z alishahali1382 Ice Hockey World Championship (CEOI15_bobek) C++14
100 / 100
455 ms 8704 KB
#include <bits/stdc++.h>
#pragma GCC optimize ("O2")
#pragma GCC optimize ("unroll-loops")
//#pragma GCC optimize("no-stack-protector,fast-math")

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef pair<ll, ll> pll;
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugp(x) cerr<<#x<<"= {"<<(x.first)<<", "<<(x.second)<<"}"<<endl;
#define debug2(x, y) cerr<<"{"<<#x<<", "<<#y<<"} = {"<<(x)<<", "<<(y)<<"}"<<endl;
#define debugv(v) {cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;}
#define all(x) x.begin(), x.end()
#define pb push_back
#define kill(x) return cout<<x<<'\n', 0;

const ld eps=1e-7;
const int inf=1000000010;
const ll INF=10000000000000010LL;
const int mod = 1000000007;
const int N=20;

ll n, m, k, u, v, x, y, t, a, b, ans;
ll A[N<<1];
ll B[1<<N];

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	cin>>n>>m;
	for (int i=0; i<n; i++) cin>>A[i];
	for (int mask=1; mask<(1<<N); mask++){
		int bit=__builtin_ctz(mask);
		B[mask]=B[mask^(1<<bit)] + A[bit];
	}
	sort(B, B+(1<<N));
	for (int mask=0; mask<(1<<N); mask++){
		ll sum=0;
		for (int i=0; i<N; i++) sum+=((mask>>i)&1)*A[N+i];
		ans+=upper_bound(B, B+(1<<N), m-sum)-B;
	}
	ans>>=2*N-n;
	cout<<ans<<'\n';
	
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 83 ms 8576 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 115 ms 8568 KB Output is correct
2 Correct 107 ms 8576 KB Output is correct
3 Correct 94 ms 8576 KB Output is correct
4 Correct 105 ms 8576 KB Output is correct
5 Correct 107 ms 8576 KB Output is correct
6 Correct 123 ms 8596 KB Output is correct
7 Correct 104 ms 8576 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 137 ms 8576 KB Output is correct
2 Correct 136 ms 8576 KB Output is correct
3 Correct 142 ms 8576 KB Output is correct
4 Correct 80 ms 8576 KB Output is correct
5 Correct 92 ms 8576 KB Output is correct
6 Correct 177 ms 8696 KB Output is correct
7 Correct 139 ms 8576 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 149 ms 8576 KB Output is correct
2 Correct 146 ms 8576 KB Output is correct
3 Correct 141 ms 8576 KB Output is correct
4 Correct 144 ms 8576 KB Output is correct
5 Correct 90 ms 8576 KB Output is correct
6 Correct 159 ms 8576 KB Output is correct
7 Correct 139 ms 8576 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 354 ms 8576 KB Output is correct
2 Correct 415 ms 8592 KB Output is correct
3 Correct 394 ms 8576 KB Output is correct
4 Correct 427 ms 8696 KB Output is correct
5 Correct 144 ms 8576 KB Output is correct
6 Correct 133 ms 8576 KB Output is correct
7 Correct 139 ms 8576 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 371 ms 8696 KB Output is correct
2 Correct 361 ms 8576 KB Output is correct
3 Correct 342 ms 8596 KB Output is correct
4 Correct 91 ms 8576 KB Output is correct
5 Correct 124 ms 8592 KB Output is correct
6 Correct 145 ms 8576 KB Output is correct
7 Correct 141 ms 8704 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 455 ms 8592 KB Output is correct
2 Correct 418 ms 8576 KB Output is correct
3 Correct 374 ms 8576 KB Output is correct
4 Correct 136 ms 8576 KB Output is correct
5 Correct 112 ms 8576 KB Output is correct
6 Correct 141 ms 8576 KB Output is correct
7 Correct 144 ms 8596 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 379 ms 8576 KB Output is correct
2 Correct 321 ms 8696 KB Output is correct
3 Correct 326 ms 8576 KB Output is correct
4 Correct 125 ms 8576 KB Output is correct
5 Correct 130 ms 8588 KB Output is correct
6 Correct 158 ms 8576 KB Output is correct
7 Correct 136 ms 8576 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 358 ms 8592 KB Output is correct
2 Correct 349 ms 8576 KB Output is correct
3 Correct 266 ms 8696 KB Output is correct
4 Correct 284 ms 8576 KB Output is correct
5 Correct 142 ms 8576 KB Output is correct
6 Correct 160 ms 8576 KB Output is correct
7 Correct 137 ms 8696 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 286 ms 8576 KB Output is correct
2 Correct 434 ms 8672 KB Output is correct
3 Correct 308 ms 8576 KB Output is correct
4 Correct 393 ms 8696 KB Output is correct
5 Correct 126 ms 8576 KB Output is correct
6 Correct 162 ms 8576 KB Output is correct
7 Correct 138 ms 8576 KB Output is correct