답안 #85968

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
85968 2018-11-23T13:55:21 Z Nordway Ice Hockey World Championship (CEOI15_bobek) C++14
50 / 100
482 ms 9164 KB
#include<bits/stdc++.h>
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define up_b upper_bound
#define low_b lower_bound
#define sz(x) (int)x.size()
#define all(v) v.begin(),v.end()
#define boost ios_base::sync_with_stdio(0),cin.tie(0)
#define FILE "divide"

using namespace std;


typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<int,ll> pil;
typedef pair<ll,int> pli;
typedef pair<ll,ll> pll;

const int mod=1e9+7;
const int inf=1e9;
const ll INF=1e18;
const ld pi=acos(-1);
const int N=41;

ll a[N];

int main(){
	/*freopen(FILE".in","r",stdin);
	freopen(FILE".out","w",stdout);*/
	int n,m;
	cin>>n>>m;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	int fn=(n+1)/2;
	int sn=n-fn;
	vector<ll>v;
	for(int mask=0;mask<(1<<fn);mask++){
		ll sum=0;
		for(int i=0;i<fn;i++){
			if((mask>>i)&1)sum+=a[i];
		}
		if(sum>m)continue;
		v.pb(sum);
	}
	sort(all(v));
	ll ans=0;
	for(int mask=0;mask<(1<<sn);mask++){
		ll sum=0;
		for(int i=0;i<sn;i++){
			if((mask>>i)&1)sum+=a[fn+i];
		}
		if(sum>m)continue;
		int pos=up_b(all(v),m-sum)-v.begin();
		ans+=pos;
	}
	cout<<ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 508 KB Output is correct
2 Correct 2 ms 508 KB Output is correct
3 Correct 3 ms 508 KB Output is correct
4 Correct 2 ms 544 KB Output is correct
5 Correct 2 ms 544 KB Output is correct
6 Correct 2 ms 544 KB Output is correct
7 Correct 3 ms 576 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 592 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 620 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 36 ms 1748 KB Output is correct
2 Correct 127 ms 2796 KB Output is correct
3 Correct 482 ms 9000 KB Output is correct
4 Correct 119 ms 9000 KB Output is correct
5 Correct 19 ms 9000 KB Output is correct
6 Correct 10 ms 9000 KB Output is correct
7 Correct 11 ms 9000 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 53 ms 9000 KB Output is correct
2 Correct 40 ms 9000 KB Output is correct
3 Correct 225 ms 9000 KB Output is correct
4 Correct 2 ms 9000 KB Output is correct
5 Correct 9 ms 9000 KB Output is correct
6 Correct 21 ms 9000 KB Output is correct
7 Correct 14 ms 9000 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 83 ms 9000 KB Output is correct
2 Correct 180 ms 9000 KB Output is correct
3 Correct 162 ms 9000 KB Output is correct
4 Correct 2 ms 9000 KB Output is correct
5 Correct 102 ms 9000 KB Output is correct
6 Correct 301 ms 9092 KB Output is correct
7 Correct 60 ms 9092 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 180 ms 9164 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 22 ms 9164 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 278 ms 9164 KB Output isn't correct
2 Halted 0 ms 0 KB -