Submission #308918

# Submission time Handle Problem Language Result Execution time Memory
308918 2020-10-02T09:22:18 Z syy Ice Hockey World Championship (CEOI15_bobek) C++17
100 / 100
600 ms 8840 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define FOR(i, a, b) for(ll i = (ll)a; i <= (ll)b; i++)
#define DEC(i, a, b) for(ll i = (ll)a; i >= (ll)b; i--)
typedef pair<ll, ll> pi;
typedef pair<ll, pi> pii;
typedef pair<pi, pi> pipi;
#define f first
#define s second
typedef vector<ll> vi;
typedef vector<pi> vpi;
typedef vector<pii> vpii;
#define pb push_back
#define pf push_front
#define all(v) v.begin(), v.end()
#define disc(v) sort(all(v)); v.resize(unique(all(v)) - v.begin());
#define INF (ll) 1e9 + 100
#define LLINF (ll) 1e18
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
inline ll rand(ll x, ll y) { ++y; return (rng() % (y-x)) + x; } //inclusivesss

ll n, m, arr[45], h, ans;
vi v;

int main() {
	fastio; cin >> n >> m;
	FOR(i, 0, n-1) cin >> arr[i];
	h = n/2-1; // [0, h], [h+1, n-1]
	FOR(i, 0, (1<<(n-1-h-1+1))-1) {
		ll cur = 0;
		FOR(j, 0, n-1-h-1) if (i & (1<<j)) cur += arr[j + h+1];
		v.pb(cur);
	}
	sort(all(v));
	FOR(i, 0, (1<<(h+1))-1) {
		ll cur = 0;
		FOR(j, 0, h) if (i & (1<<j)) cur += arr[j];
		auto it = upper_bound(all(v), m-cur);
		ans += it - v.begin();
	}
	cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 35 ms 1532 KB Output is correct
2 Correct 114 ms 2552 KB Output is correct
3 Correct 600 ms 8676 KB Output is correct
4 Correct 106 ms 2552 KB Output is correct
5 Correct 18 ms 1024 KB Output is correct
6 Correct 8 ms 768 KB Output is correct
7 Correct 16 ms 1024 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 47 ms 1532 KB Output is correct
2 Correct 34 ms 1532 KB Output is correct
3 Correct 210 ms 4596 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 8 ms 768 KB Output is correct
6 Correct 15 ms 1024 KB Output is correct
7 Correct 16 ms 1024 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 68 ms 2564 KB Output is correct
2 Correct 158 ms 4596 KB Output is correct
3 Correct 155 ms 4596 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 93 ms 4596 KB Output is correct
6 Correct 253 ms 8676 KB Output is correct
7 Correct 115 ms 4592 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 379 ms 8680 KB Output is correct
2 Correct 32 ms 1532 KB Output is correct
3 Correct 11 ms 768 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 8 ms 768 KB Output is correct
6 Correct 227 ms 8680 KB Output is correct
7 Correct 16 ms 1024 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 36 ms 1532 KB Output is correct
2 Correct 100 ms 2552 KB Output is correct
3 Correct 11 ms 768 KB Output is correct
4 Correct 11 ms 768 KB Output is correct
5 Correct 113 ms 4588 KB Output is correct
6 Correct 26 ms 1532 KB Output is correct
7 Correct 292 ms 8672 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 422 ms 8676 KB Output is correct
2 Correct 35 ms 1532 KB Output is correct
3 Correct 10 ms 768 KB Output is correct
4 Correct 590 ms 8840 KB Output is correct
5 Correct 145 ms 4588 KB Output is correct
6 Correct 16 ms 1024 KB Output is correct
7 Correct 32 ms 1532 KB Output is correct