Submission #56217

# Submission time Handle Problem Language Result Execution time Memory
56217 2018-07-10T09:13:32 Z mraron Ice Hockey World Championship (CEOI15_bobek) C++14
100 / 100
624 ms 9516 KB
/*
ID: noszaly1
TASK: {TASK}
LANG: C++11               
*/

//Noszály Áron 10o Debreceni Fazekas Mihály Gimnázium

#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<cassert>
#include<cassert>
#include<unordered_map>
#include<unordered_set>
#include<functional>
#include<queue>
#include<stack>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<sstream>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<numeric>
using namespace std;

#define all(x) (x).begin(), (x).end()
#define pb push_back
#define xx first
#define yy second
#define sz(x) (int)(x).size()
#define gc getchar
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mp make_pair

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

const double PI=acos(-1);

template<typename T> T getint() {
	T val=0;
	char c;
	
	bool neg=false;
	while((c=gc()) && !(c>='0' && c<='9')) {
		neg|=c=='-';
	}

	do {
		val=(val*10)+c-'0';
	} while((c=gc()) && (c>='0' && c<='9'));

	return val*(neg?-1:1);
}

int main() {
	IO;
	ll n,m;
	cin>>n>>m;
	vector<ll> t(n);
	for(int i=0;i<n;++i) {
		cin>>t[i];
	}
	
	vector<ll> lst;
	for(ll i=0;i<(1<<((n+1)/2));++i) {
		ll sum=0;
		for(ll j=0;j<((n+1)/2);++j) {
			if(i&(1<<j)) {
				sum+=t[j];
			}
		}
		
		
		if(sum>m) continue ;
		lst.pb(sum);
	}

	sort(all(lst));
	
	ll ans=0;
	
	for(ll i=0;i<(1<<(n/2));++i) {
		ll sum=0;
		for(ll j=0;j<(n/2);++j) {
			if(i&(1<<j)) {
				sum+=t[j+(n+1)/2];
			}
		}
		
		if(sum>m) continue ;

		ans+=lower_bound(all(lst), m-sum+1)-lst.begin();
	}
	
	cout<<ans<<"\n";
	
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 480 KB Output is correct
2 Correct 2 ms 592 KB Output is correct
3 Correct 2 ms 596 KB Output is correct
4 Correct 2 ms 708 KB Output is correct
5 Correct 3 ms 876 KB Output is correct
6 Correct 2 ms 876 KB Output is correct
7 Correct 3 ms 876 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 876 KB Output is correct
2 Correct 3 ms 876 KB Output is correct
3 Correct 3 ms 876 KB Output is correct
4 Correct 3 ms 876 KB Output is correct
5 Correct 2 ms 876 KB Output is correct
6 Correct 3 ms 876 KB Output is correct
7 Correct 3 ms 876 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 876 KB Output is correct
2 Correct 3 ms 876 KB Output is correct
3 Correct 2 ms 876 KB Output is correct
4 Correct 2 ms 908 KB Output is correct
5 Correct 2 ms 912 KB Output is correct
6 Correct 3 ms 912 KB Output is correct
7 Correct 4 ms 920 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 39 ms 2072 KB Output is correct
2 Correct 136 ms 3092 KB Output is correct
3 Correct 624 ms 9376 KB Output is correct
4 Correct 140 ms 9376 KB Output is correct
5 Correct 22 ms 9376 KB Output is correct
6 Correct 11 ms 9376 KB Output is correct
7 Correct 12 ms 9376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 61 ms 9376 KB Output is correct
2 Correct 46 ms 9376 KB Output is correct
3 Correct 293 ms 9376 KB Output is correct
4 Correct 2 ms 9376 KB Output is correct
5 Correct 14 ms 9376 KB Output is correct
6 Correct 21 ms 9376 KB Output is correct
7 Correct 14 ms 9376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 93 ms 9376 KB Output is correct
2 Correct 204 ms 9376 KB Output is correct
3 Correct 186 ms 9376 KB Output is correct
4 Correct 2 ms 9376 KB Output is correct
5 Correct 117 ms 9376 KB Output is correct
6 Correct 365 ms 9376 KB Output is correct
7 Correct 79 ms 9376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 458 ms 9376 KB Output is correct
2 Correct 43 ms 9376 KB Output is correct
3 Correct 14 ms 9376 KB Output is correct
4 Correct 2 ms 9376 KB Output is correct
5 Correct 11 ms 9376 KB Output is correct
6 Correct 297 ms 9460 KB Output is correct
7 Correct 13 ms 9460 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 48 ms 9460 KB Output is correct
2 Correct 137 ms 9460 KB Output is correct
3 Correct 15 ms 9460 KB Output is correct
4 Correct 17 ms 9460 KB Output is correct
5 Correct 135 ms 9460 KB Output is correct
6 Correct 37 ms 9460 KB Output is correct
7 Correct 181 ms 9460 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 520 ms 9460 KB Output is correct
2 Correct 47 ms 9460 KB Output is correct
3 Correct 13 ms 9460 KB Output is correct
4 Correct 618 ms 9516 KB Output is correct
5 Correct 172 ms 9516 KB Output is correct
6 Correct 23 ms 9516 KB Output is correct
7 Correct 22 ms 9516 KB Output is correct