Submission #781201

# Submission time Handle Problem Language Result Execution time Memory
781201 2023-07-12T22:36:47 Z NK_ Ice Hockey World Championship (CEOI15_bobek) C++17
0 / 100
1000 ms 28608 KB
// Success consists of going from failure to failure without loss of enthusiasm
#include <bits/stdc++.h>

using namespace std;

#define nl '\n'
#define sz(x) int(x.size())

using ll = long long;

template<class T> using V = vector<T>;

int main() {
	cin.tie(0)->sync_with_stdio(0);
	
	int N; ll M; cin >> N >> M;

	int a = N / 2, b = N - a;

	V<ll> A(a), B(b);
	for(auto& x : A) cin >> x;
	for(auto& x : B) cin >> x;

	V<ll> SA, SB;
	auto get = [&](const V<ll>& X) {
		int n = sz(X);
		V<ll> S;
		for(int i = 0; i < (1<<n); i++) {
			ll sum = 0;
			for(int b = 0; b < n; b++) if ((i >> b) & 1) sum += X[b];
			if (sum <= M) {
				S.push_back(sum);
				cout << i << " " << sum << endl;
			}
		}
		cout << endl;
		return S;
	};	

	SA = get(A);
	SB = get(B);

	sort(begin(SA), end(SA));
	sort(begin(SB), end(SB));
	
	ll ans = 0;
	for(auto x : SA) {
		ll left = M - x;
		int amt = upper_bound(begin(SB), end(SB), left) - begin(SB);
		cout << left << " " << amt << endl;
		ans += amt;
	}

	cout << ans << nl;

    return 0;
}


# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 313 ms 4992 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 466 ms 7292 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 616 ms 10508 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1062 ms 28420 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 320 ms 7768 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1079 ms 28608 KB Time limit exceeded
2 Halted 0 ms 0 KB -