Submission #113114

# Submission time Handle Problem Language Result Execution time Memory
113114 2019-05-23T19:23:59 Z ioilolcom Ice Hockey World Championship (CEOI15_bobek) C++14
20 / 100
1000 ms 384 KB
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long int ll;
vector<int> 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;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
# Verdict Execution time Memory 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 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1074 ms 384 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1072 ms 256 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1065 ms 300 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1075 ms 256 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1062 ms 256 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1060 ms 256 KB Time limit exceeded
2 Halted 0 ms 0 KB -