답안 #376199

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
376199 2021-03-11T04:23:22 Z YJU Ice Hockey World Championship (CEOI15_bobek) C++14
100 / 100
239 ms 16896 KB
#include<bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector,Ofast")
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll N=(1LL<<20)+1;
const ll MOD=1e9+7;
const ll INF=(1LL<<61);
const ld pi=acos(-1);
#define REP(i,n) for(int i=0;i<n;++i)
#define REP1(i,n) for(int i=1;i<=n;++i)
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define lwb lower_bound
#define SZ(_a) (ll)_a.size()
#define count(_a) (ll)__builtin_popcount(_a)

ll num,k,n,m,ans,id,a[N],b[N];

int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	cin>>num>>k;
	n=num/2,m=num-n;
	REP(i,n)cin>>a[1<<i];
	REP(i,m)cin>>b[1<<i];
	for(int i=0;i<(1<<n);i++){
		a[i]=a[i^(i&-i)]+a[(i&-i)];
	}
	for(int i=0;i<(1<<m);i++){
		b[i]=b[i^(i&-i)]+b[(i&-i)];
	}
	n=(1<<n),m=(1<<m);
	sort(a,a+n,greater<ll> ());
	sort(b,b+m);
	REP(i,n){
		while(id<m&&b[id]+a[i]<=k)++id;
		ans+=id;
	}
	cout<<ans<<"\n";
	return 0;
}
/*
*/
# 결과 실행 시간 메모리 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 384 KB Output is correct
4 Correct 1 ms 384 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 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 17 ms 1900 KB Output is correct
2 Correct 51 ms 4460 KB Output is correct
3 Correct 212 ms 16748 KB Output is correct
4 Correct 52 ms 4460 KB Output is correct
5 Correct 7 ms 1388 KB Output is correct
6 Correct 5 ms 876 KB Output is correct
7 Correct 11 ms 1388 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 2412 KB Output is correct
2 Correct 21 ms 1900 KB Output is correct
3 Correct 75 ms 8556 KB Output is correct
4 Correct 1 ms 492 KB Output is correct
5 Correct 4 ms 876 KB Output is correct
6 Correct 11 ms 1388 KB Output is correct
7 Correct 11 ms 1388 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 36 ms 3436 KB Output is correct
2 Correct 75 ms 6508 KB Output is correct
3 Correct 76 ms 6508 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 32 ms 6508 KB Output is correct
6 Correct 158 ms 16808 KB Output is correct
7 Correct 71 ms 6508 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 155 ms 12712 KB Output is correct
2 Correct 17 ms 1900 KB Output is correct
3 Correct 6 ms 876 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 4 ms 876 KB Output is correct
6 Correct 151 ms 12712 KB Output is correct
7 Correct 11 ms 1388 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 1900 KB Output is correct
2 Correct 49 ms 4588 KB Output is correct
3 Correct 6 ms 876 KB Output is correct
4 Correct 6 ms 876 KB Output is correct
5 Correct 40 ms 6528 KB Output is correct
6 Correct 16 ms 1900 KB Output is correct
7 Correct 210 ms 16876 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 208 ms 16896 KB Output is correct
2 Correct 17 ms 1900 KB Output is correct
3 Correct 8 ms 876 KB Output is correct
4 Correct 239 ms 16748 KB Output is correct
5 Correct 49 ms 8556 KB Output is correct
6 Correct 11 ms 1388 KB Output is correct
7 Correct 22 ms 2412 KB Output is correct