Submission #168791

# Submission time Handle Problem Language Result Execution time Memory
168791 2019-12-16T11:34:55 Z mosiashvililuka Ice Hockey World Championship (CEOI15_bobek) C++14
20 / 100
1000 ms 73296 KB
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,e,f[49],i,j,zx,xc,pas;
map <long long, long long> m;
map <long long, long long>::iterator t;
set <pair <long long, long long> > s;
set <pair <long long, long long> >::iterator it;
int main(){
	ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	cin>>a>>b;
	for(c=0; c<a; c++) cin>>f[c];
	d=min(20LL,a);
	for(c=0; c<(1<<d); c++){
		e=0;
		for(i=0; i<d; i++){
			if(((1<<i)&c)!=0) e+=f[i];
		}
		m[e]++;
	}
	e=0;
	for(t=m.begin(); t!=m.end(); t++){
		e+=(*t).second;
		s.insert(make_pair((*t).first,e));
	}
	if(a<=20){
		it=s.lower_bound(make_pair(b+1,0));
		if(it==s.begin()){
			cout<<0;
		}else{
			it--;
			cout<<(*it).second;
		}
		return 0;
	}
	e=a-d;
	for(c=0; c<(1<<e); c++){
		zx=c*(1<<d);
		xc=0;
		for(i=d; i<a; i++){
			if(((1<<i)&c)!=0) xc+=f[i];
		}
		it=s.lower_bound(make_pair(b+1-xc,0));
		if(it==s.begin()){
			
		}else{
			it--;
			pas+=(*it).second;
		}
	}
	cout<<pas;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 504 KB Output is correct
7 Correct 2 ms 388 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 144 ms 16748 KB Output is correct
2 Correct 63 ms 8484 KB Output is correct
3 Correct 142 ms 16796 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 9 ms 376 KB Output is correct
6 Execution timed out 1063 ms 68404 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1054 ms 70412 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 268 ms 2644 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 290 ms 3764 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 726 ms 40528 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1064 ms 73296 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1070 ms 69324 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1053 ms 69220 KB Time limit exceeded
2 Halted 0 ms 0 KB -