Submission #250744

# Submission time Handle Problem Language Result Execution time Memory
250744 2020-07-19T01:21:37 Z WhaleVomit Ice Hockey World Championship (CEOI15_bobek) C++14
100 / 100
564 ms 20872 KB
#include <bits/stdc++.h>
using namespace std;

#define f first
#define s second
#define pb push_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define sz(v) (int)v.size()

#define MOO(i, a, b) for(int i=a; i<b; i++)
#define M00(i, a) for(int i=0; i<a; i++)
#define MOOd(i,a,b) for(int i = (b)-1; i >= a; i--)
#define M00d(i,a) for(int i = (a)-1; i>=0; i--)

#define FAST ios::sync_with_stdio(0); cin.tie(0);
#define finish(x) return cout << x << '\n', 0;
#define dbg(x) cerr << ">>> " << #x << " = " << x << "\n";
#define _ << " _ " <<

template<class T> bool ckmin(T& a, const T& b) {return b < a ? a = b, 1 : 0;}
template<class T> bool ckmax(T& a, const T& b) {return a < b ? a = b, 1 : 0;}

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef pair<ld,ld> pd;
typedef complex<ld> cd;

const int MAX_N = 44;
int n; ll mx;
ll arr[MAX_N];
vector<ll> cnt1;
vector<ll> cnt2;

int main() { FAST
    cin >> n >> mx;
    M00(i, n) cin >> arr[i];
    M00(i, 1<<(n/2)) {
        ll s = 0;
        M00(j, n/2) if(i & (1<<j)) s += arr[j];
        cnt1.pb(s);
    }
    M00(i, 1<<(n-n/2)) {
        ll s = 0;
        M00(j, n-n/2) if(i & (1<<j)) s += arr[n/2 + j];
        cnt2.pb(s);
    }
    sort(all(cnt2));
    ll res = 0;
    for(ll x: cnt1) {
        ll ub = mx - x;
        int lo = -1;
        int hi = sz(cnt2);
        while(lo+1 != hi) {
            int mid = (lo + hi)/2;
            if(cnt2[mid] <= ub) lo = mid;
            else hi = mid;
        }
        res += lo+1;
    }
    finish(res);
}

# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 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 0 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 0 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 0 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 32 ms 2044 KB Output is correct
2 Correct 107 ms 5484 KB Output is correct
3 Correct 564 ms 20864 KB Output is correct
4 Correct 115 ms 5488 KB Output is correct
5 Correct 17 ms 1788 KB Output is correct
6 Correct 8 ms 1024 KB Output is correct
7 Correct 17 ms 1660 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 47 ms 2936 KB Output is correct
2 Correct 34 ms 2044 KB Output is correct
3 Correct 215 ms 10596 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 8 ms 1024 KB Output is correct
6 Correct 21 ms 1660 KB Output is correct
7 Correct 18 ms 1660 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 73 ms 3576 KB Output is correct
2 Correct 156 ms 6632 KB Output is correct
3 Correct 166 ms 6632 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 89 ms 6632 KB Output is correct
6 Correct 266 ms 20872 KB Output is correct
7 Correct 113 ms 6632 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 354 ms 12768 KB Output is correct
2 Correct 31 ms 2044 KB Output is correct
3 Correct 11 ms 1024 KB Output is correct
4 Correct 1 ms 288 KB Output is correct
5 Correct 8 ms 1024 KB Output is correct
6 Correct 225 ms 12772 KB Output is correct
7 Correct 17 ms 1660 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 33 ms 2044 KB Output is correct
2 Correct 103 ms 5480 KB Output is correct
3 Correct 10 ms 1024 KB Output is correct
4 Correct 10 ms 1024 KB Output is correct
5 Correct 102 ms 6632 KB Output is correct
6 Correct 26 ms 2044 KB Output is correct
7 Correct 297 ms 20820 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 420 ms 20824 KB Output is correct
2 Correct 35 ms 2044 KB Output is correct
3 Correct 11 ms 1024 KB Output is correct
4 Correct 554 ms 20824 KB Output is correct
5 Correct 134 ms 10596 KB Output is correct
6 Correct 16 ms 1660 KB Output is correct
7 Correct 35 ms 2936 KB Output is correct