Submission #963420

# Submission time Handle Problem Language Result Execution time Memory
963420 2024-04-15T01:43:42 Z pcc Ice Hockey World Championship (CEOI15_bobek) C++17
50 / 100
298 ms 20968 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define fs first
#define sc second
#define tlll tuple<ll,ll,ll>

const int mxn = 40;

int N,M;
vector<ll> lv,rv;
vector<ll> la,ra;

void calc(vector<ll> &v,vector<ll>& all){
	for(int i = 0;i<(1<<v.size());i++){
		ll sum = 0;
		for(int j = 0;j<v.size();j++){
			if(i&(1<<j))sum += v[j];
		}
		all.push_back(sum);
	}
	sort(all.begin(),all.end());
	return;
}

int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>N>>M;
	for(int i = 0;i<N/2;i++){
		ll k;
		cin>>k;
		la.push_back(k);
	}
	for(int i = N/2;i<N;i++){
		ll k;
		cin>>k;
		ra.push_back(k);
	}
	calc(la,lv);
	calc(ra,rv);
	ll pt = 0;
	ll ans = 0;
	reverse(lv.begin(),lv.end());
	for(auto &i:lv){
		while(pt<rv.size()&&rv[pt]+i<=M)pt++;
		ans += pt;
	}
	cout<<ans<<'\n';
	return 0;
}

Compilation message

bobek.cpp: In function 'void calc(std::vector<long long int>&, std::vector<long long int>&)':
bobek.cpp:20:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |   for(int j = 0;j<v.size();j++){
      |                 ~^~~~~~~~~
bobek.cpp: In function 'int main()':
bobek.cpp:48:11: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   48 |   while(pt<rv.size()&&rv[pt]+i<=M)pt++;
      |         ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 24 ms 2144 KB Output is correct
2 Correct 68 ms 5708 KB Output is correct
3 Correct 298 ms 20824 KB Output is correct
4 Correct 68 ms 5572 KB Output is correct
5 Correct 12 ms 1756 KB Output is correct
6 Correct 7 ms 1116 KB Output is correct
7 Correct 15 ms 1500 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 31 ms 3284 KB Output is correct
2 Correct 24 ms 2140 KB Output is correct
3 Correct 118 ms 12128 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 6 ms 1112 KB Output is correct
6 Correct 15 ms 1632 KB Output is correct
7 Correct 15 ms 1500 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 48 ms 3676 KB Output is correct
2 Correct 105 ms 6984 KB Output is correct
3 Correct 103 ms 8412 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 69 ms 7152 KB Output is correct
6 Correct 253 ms 20860 KB Output is correct
7 Correct 100 ms 8524 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 152 ms 14148 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 2140 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 198 ms 20968 KB Output isn't correct
2 Halted 0 ms 0 KB -