Submission #939310

# Submission time Handle Problem Language Result Execution time Memory
939310 2024-03-06T08:54:46 Z parlimoos Ice Hockey World Championship (CEOI15_bobek) C++14
100 / 100
460 ms 22720 KB
//Be Name KHODA
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
#define pb push_back
#define pp pop_back
#define lb lower_bound
#define ub upper_bound
#define cl clear
#define bg begin
#define arr(x) array<int , x>
#define endl '\n'

int n;
ll m;
vector<ll> a , b;
vector<ll> ls , rs;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);

    cin >> n >> m;
    for(int i = 0 ; i < min(n , 20) ; i++){
        ll d;
        cin >> d;
        a.pb(d);
    }
    for(int i = 20 ; i < n ; i++){
        ll d;
        cin >> d;
        b.pb(d);
    }

    for(int msk = 0 ; msk < (1 << min(n , 20)) ; msk++){
        ll d = 0;
        for(int i = 0 ; i < min(n , 20) ; i++) if(((msk >> i) & 1)) d += a[i];
        ls.pb(d);
    }
    for(int msk = 0 ; msk < (1 << (n - min(n , 20))) ; msk++){
        ll d = 0;
        for(int i = 0 ; i < (n - min(n , 20)) ; i++) if(((msk >> i) & 1)) d += b[i];
        rs.pb(d);
    }
    sort(rs.bg() , rs.end());
    ll o = 0;
    for(ll l : ls){
        if(l > m) continue;
        o += int(ub(rs.bg() , rs.end() , m - l) - rs.bg());
    }
    cout << o;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 1500 KB Output is correct
2 Correct 4 ms 992 KB Output is correct
3 Correct 8 ms 1500 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 4 ms 988 KB Output is correct
6 Correct 69 ms 9168 KB Output is correct
7 Correct 8 ms 1496 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 71 ms 9420 KB Output is correct
2 Correct 17 ms 2520 KB Output is correct
3 Correct 5 ms 992 KB Output is correct
4 Correct 4 ms 992 KB Output is correct
5 Correct 67 ms 9812 KB Output is correct
6 Correct 9 ms 1496 KB Output is correct
7 Correct 8 ms 1496 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 128 ms 9152 KB Output is correct
2 Correct 178 ms 9652 KB Output is correct
3 Correct 416 ms 22720 KB Output is correct
4 Correct 184 ms 9988 KB Output is correct
5 Correct 87 ms 10176 KB Output is correct
6 Correct 77 ms 9152 KB Output is correct
7 Correct 67 ms 9156 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 144 ms 9580 KB Output is correct
2 Correct 122 ms 10184 KB Output is correct
3 Correct 226 ms 12528 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 83 ms 10636 KB Output is correct
6 Correct 78 ms 10436 KB Output is correct
7 Correct 68 ms 9160 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 150 ms 9164 KB Output is correct
2 Correct 204 ms 10648 KB Output is correct
3 Correct 205 ms 10560 KB Output is correct
4 Correct 18 ms 2520 KB Output is correct
5 Correct 101 ms 10460 KB Output is correct
6 Correct 229 ms 22716 KB Output is correct
7 Correct 84 ms 10596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 295 ms 16864 KB Output is correct
2 Correct 116 ms 9708 KB Output is correct
3 Correct 114 ms 8828 KB Output is correct
4 Correct 2 ms 732 KB Output is correct
5 Correct 79 ms 9412 KB Output is correct
6 Correct 159 ms 16820 KB Output is correct
7 Correct 69 ms 8844 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 123 ms 9412 KB Output is correct
2 Correct 166 ms 10436 KB Output is correct
3 Correct 94 ms 10696 KB Output is correct
4 Correct 101 ms 9672 KB Output is correct
5 Correct 112 ms 10532 KB Output is correct
6 Correct 79 ms 10180 KB Output is correct
7 Correct 213 ms 21428 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 333 ms 22712 KB Output is correct
2 Correct 139 ms 8904 KB Output is correct
3 Correct 103 ms 10432 KB Output is correct
4 Correct 460 ms 21688 KB Output is correct
5 Correct 130 ms 12732 KB Output is correct
6 Correct 78 ms 10440 KB Output is correct
7 Correct 68 ms 10448 KB Output is correct