답안 #113115

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
113115 2019-05-23T19:24:58 Z ioilolcom Ice Hockey World Championship (CEOI15_bobek) C++14
40 / 100
1000 ms 484 KB
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long int ll;
vector<ll> v1,v2,v;
set<ll>d1,d2;
void solve(int idx,ll s,int t){
	if(t==1) {
		if(idx==(int)v1.size()) {
			d1.insert(s);
			return;
		}
	}
	else{
		if(idx==(int)v2.size()) {
			d2.insert(s);
			return;
		}
	}
	solve(idx+1,s+v1[idx],t);
	solve(idx+1,s,t);
}
set<ll> an;
ll n,m;
ll ans=0;
void solv(int idx,ll s){
	if(idx==n) {
		if(s<=m) {
			ans++;
		}
		return;
	}
	solv(idx+1,s+v[idx]);
	solv(idx+1,s);
}
int main()
{

	ios_base:: sync_with_stdio(false); cin.tie(0);
	cin>>n>>m;
	for(int i=1; i<=n; i++) {
		ll a; cin>>a;
		v.push_back(a);
		//	if(i&1) v1.push_back(a);
		//else v2.push_back(a);
	}
	//solve(0,0,1);
	//solve(0,0,2);

	solv(0,0);
//	for(int u:an) cout<<u<<" ";
	//cout<<endl;
	cout<<ans<<endl;
/*
   for(int v:d1) {
                cout<<v<<endl;
                //	auto it=d2.lower_bound(m-v);
                //ans+=(distance(d2.begin(),it));
        }
        cout<<"set 2"<<endl;
        for(int v:d2) {
                cout<<v<<endl;
                //	auto it=d2.lower_bound(m-v);
                //ans+=(distance(d2.begin(),it));
        }
 */
	//cout<<ans<<endl;

	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 6 ms 384 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 6 ms 484 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1061 ms 384 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1075 ms 256 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1070 ms 256 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1069 ms 384 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1071 ms 256 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1075 ms 256 KB Time limit exceeded
2 Halted 0 ms 0 KB -