Submission #380170

# Submission time Handle Problem Language Result Execution time Memory
380170 2021-03-20T12:40:26 Z vishesh312 Ice Hockey World Championship (CEOI15_bobek) C++17
40 / 100
1000 ms 384 KB
#include "bits/stdc++.h"
using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using ordered_set = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;
*/

#define all(x) begin(x), end(x)
#define sz(x) (int)x.size()

using ll = long long;
const int mod = 1e9+7;

void solve(int tc) {
    int n;
    ll k;
    cin >> n >> k;
    vector<ll> a(n/2), b(n-n/2);
    for (auto &x : a) cin >> x;
    for (auto &x : b) cin >> x;
    n = sz(a);
    int m = sz(b);
    ll ans = 0;
    for (int maska = 0; maska < (1<<n); ++maska) {
        ll x = 0;
        for (int i = 0; i < n; ++i) if (maska&(1<<i)) x += a[i];
        for (int maskb = 0; maskb < (1<<m); ++maskb) {
            ll y = 0;
            for (int j = 0; j < m; ++j) if (maskb&(1<<j)) y += b[j];
            ans += (x + y <= k);
        }
    }
    cout << ans << '\n';
}

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int tc = 1;
    //cin >> tc;
    for (int i = 1; i <= tc; ++i) solve(i);
    return 0;
}

# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 364 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 4 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 2 ms 364 KB Output is correct
6 Correct 37 ms 364 KB Output is correct
7 Correct 5 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 36 ms 364 KB Output is correct
2 Correct 7 ms 364 KB Output is correct
3 Correct 2 ms 364 KB Output is correct
4 Correct 2 ms 364 KB Output is correct
5 Correct 37 ms 364 KB Output is correct
6 Correct 4 ms 364 KB Output is correct
7 Correct 4 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1075 ms 364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1094 ms 364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1088 ms 364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1092 ms 364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1091 ms 364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1084 ms 364 KB Time limit exceeded
2 Halted 0 ms 0 KB -