Submission #104299

# Submission time Handle Problem Language Result Execution time Memory
104299 2019-04-05T02:23:46 Z tduong0806 Ice Hockey World Championship (CEOI15_bobek) C++14
100 / 100
515 ms 8716 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define forinc(i,a,b) for(int i=a;i<=b;++i)
#define fordec(i,a,b) for(int i=a;i>=b;--i)
#define forv(a,b) for(auto &a:b)
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define all(a) a.begin(),a.end()
#define reset(f,x) memset(f,x,sizeof(f))
#define bit(x,i) ((x>>(i-1))&1)
#define onbit(x,i) (x|(1<<(i-1)))
#define offbit(x,i) (x&~(1<<(i-1)))
#define read2(a,b) read(a),read(b)
#define read3(a,b,c) read(a),read(b),read(c)
const int N=42;
int n,x[N];
ll a[N],m,kq;
vector<ll> e;
void duyet(int i,int l,ll s)
{
    if(i==l+1)
    {
        if(l==n/2) e.pb(s);
        else kq+=upper_bound(all(e),m-s)-e.begin();
        return;
    }
    duyet(i+1,l,s);
    duyet(i+1,l,s+a[i]);
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    //freopen("BOBEK.inp","r",stdin);
    cin>>n>>m;
    forinc(i,1,n) cin>>a[i];
    duyet(1,n/2,0);
    sort(all(e));
    duyet(n/2+1,n,0);
    cout<<kq;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 3 ms 384 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 3 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 3 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 24 ms 1024 KB Output is correct
2 Correct 86 ms 2552 KB Output is correct
3 Correct 515 ms 8560 KB Output is correct
4 Correct 78 ms 2552 KB Output is correct
5 Correct 12 ms 1024 KB Output is correct
6 Correct 6 ms 768 KB Output is correct
7 Correct 10 ms 1024 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 33 ms 1532 KB Output is correct
2 Correct 23 ms 1024 KB Output is correct
3 Correct 156 ms 4596 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 6 ms 768 KB Output is correct
6 Correct 11 ms 1024 KB Output is correct
7 Correct 10 ms 1024 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 62 ms 1532 KB Output is correct
2 Correct 154 ms 2552 KB Output is correct
3 Correct 133 ms 2552 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 35 ms 2552 KB Output is correct
6 Correct 137 ms 8688 KB Output is correct
7 Correct 41 ms 2552 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 305 ms 4596 KB Output is correct
2 Correct 23 ms 1024 KB Output is correct
3 Correct 10 ms 768 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 8 ms 768 KB Output is correct
6 Correct 108 ms 4596 KB Output is correct
7 Correct 9 ms 1024 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 25 ms 1024 KB Output is correct
2 Correct 83 ms 2552 KB Output is correct
3 Correct 9 ms 768 KB Output is correct
4 Correct 9 ms 768 KB Output is correct
5 Correct 74 ms 2552 KB Output is correct
6 Correct 16 ms 1024 KB Output is correct
7 Correct 151 ms 8716 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 342 ms 8688 KB Output is correct
2 Correct 25 ms 1024 KB Output is correct
3 Correct 9 ms 768 KB Output is correct
4 Correct 510 ms 8688 KB Output is correct
5 Correct 70 ms 4596 KB Output is correct
6 Correct 11 ms 1024 KB Output is correct
7 Correct 17 ms 1532 KB Output is correct