Submission #658780

# Submission time Handle Problem Language Result Execution time Memory
658780 2022-11-14T21:57:02 Z beaconmc Ice Hockey World Championship (CEOI15_bobek) C++14
60 / 100
1000 ms 112356 KB
#include <bits/stdc++.h>


typedef long long ll;
using namespace std;


#define FOR(i, x, y) for(ll i=x; i<y; i++)
#define FORNEG(i, x, y) for(ll i=x; i>y; i--)
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)

ll sus[41];

int main(){
	ll a,b,n,m;
	map<ll, ll> aa, bb;

	cin >> n >> m;
	FOR(i,0,n) cin >> sus[i];

	a = n/2;
	b = (n-1)/2 + 1;

	

	FOR(i,0,1<<a){
		ll cur = 0, temp = 0, tempi = i;
		while (tempi){
			if (tempi&1) temp += sus[cur];
			cur++;
			tempi /=2;
		}
		aa[temp] += 1;
	}



	FOR(i,0,1<<b){
		ll cur = a, temp = 0, tempi = i;
		while (tempi){
			if (tempi&1) temp += sus[cur];
			cur++;
			tempi /=2;
		}

		bb[temp] += 1;
	}


	vector<ll> aaa, bbb;
	vector<ll> aaa2,bbb2;

	ll cur = 0;

	for (auto&i : aa){
		aaa.push_back(i.first);
		aaa2.push_back(i.second);

	}
	cur = 0;

	for (auto&i : bb){
		cur += i.second;
		bbb.push_back(i.first);
		bbb2.push_back(cur);
	}

	ll ans = 0;

	FOR(i,0,aaa.size()){

		if (m-aaa[i] < 0) continue;

		ll lower = upper_bound(bbb.begin(), bbb.end(), m-aaa[i]) - bbb.begin() - 1;

		ans += bbb2[lower] * aaa2[i];
	}
	cout << ans;




}

Compilation message

bobek.cpp: In function 'int main()':
bobek.cpp:8:35: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 | #define FOR(i, x, y) for(ll i=x; i<y; i++)
......
   70 |  FOR(i,0,aaa.size()){
      |      ~~~~~~~~~~~~~~                
bobek.cpp:70:2: note: in expansion of macro 'FOR'
   70 |  FOR(i,0,aaa.size()){
      |  ^~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 352 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 428 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 468 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 304 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 31 ms 2252 KB Output is correct
2 Correct 279 ms 29476 KB Output is correct
3 Execution timed out 1097 ms 64024 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 51 ms 3844 KB Output is correct
2 Correct 76 ms 10828 KB Output is correct
3 Correct 146 ms 1992 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 5 ms 212 KB Output is correct
6 Correct 33 ms 4592 KB Output is correct
7 Correct 59 ms 10696 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 160 ms 22892 KB Output is correct
2 Correct 313 ms 23636 KB Output is correct
3 Correct 311 ms 22900 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 57 ms 212 KB Output is correct
6 Correct 336 ms 3416 KB Output is correct
7 Correct 583 ms 65252 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1096 ms 112356 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 105 ms 16492 KB Output is correct
2 Correct 389 ms 42692 KB Output is correct
3 Correct 24 ms 5656 KB Output is correct
4 Correct 26 ms 5668 KB Output is correct
5 Correct 69 ms 296 KB Output is correct
6 Correct 103 ms 16544 KB Output is correct
7 Execution timed out 1089 ms 109348 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1090 ms 106812 KB Time limit exceeded
2 Halted 0 ms 0 KB -