Submission #86815

# Submission time Handle Problem Language Result Execution time Memory
86815 2018-11-27T15:45:30 Z igzi Ice Hockey World Championship (CEOI15_bobek) C++17
100 / 100
449 ms 21296 KB
#include <bits/stdc++.h>
#define maxN 41

using namespace std;

long long n,m,tmp,j,i,ans,a[maxN];
vector <long long> v,u;


int main()
{
    cin>>n>>m;
    for(i=0;i<n;i++) cin>>a[i];
    v.push_back(0);
    for(i=0;i<n/2;i++){
        tmp=v.size();
        for(j=0;j<tmp;j++){
            if(a[i]+v[j]>m) continue;
            v.push_back(a[i]+v[j]);
        }
    }
    u.push_back(0);
    for(i=n/2;i<n;i++){
        tmp=u.size();
        for(j=0;j<tmp;j++){
            if(a[i]+u[j]>m) continue;
            u.push_back(a[i]+u[j]);
        }
    }
    sort(u.begin(),u.end());
    for(i=0;i<v.size();i++){
        ans+=lower_bound(u.begin(),u.end(),m-v[i]+1)-u.begin();
    }
    cout<<ans<<endl;
    return 0;
}

Compilation message

bobek.cpp: In function 'int main()':
bobek.cpp:31:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(i=0;i<v.size();i++){
             ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 456 KB Output is correct
3 Correct 2 ms 476 KB Output is correct
4 Correct 2 ms 540 KB Output is correct
5 Correct 2 ms 540 KB Output is correct
6 Correct 2 ms 540 KB Output is correct
7 Correct 2 ms 568 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 588 KB Output is correct
2 Correct 2 ms 588 KB Output is correct
3 Correct 2 ms 648 KB Output is correct
4 Correct 2 ms 648 KB Output is correct
5 Correct 3 ms 648 KB Output is correct
6 Correct 2 ms 784 KB Output is correct
7 Correct 2 ms 784 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 784 KB Output is correct
2 Correct 2 ms 784 KB Output is correct
3 Correct 2 ms 784 KB Output is correct
4 Correct 2 ms 784 KB Output is correct
5 Correct 2 ms 784 KB Output is correct
6 Correct 2 ms 784 KB Output is correct
7 Correct 2 ms 784 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 28 ms 2348 KB Output is correct
2 Correct 86 ms 5800 KB Output is correct
3 Correct 449 ms 21156 KB Output is correct
4 Correct 88 ms 21156 KB Output is correct
5 Correct 33 ms 21156 KB Output is correct
6 Correct 6 ms 21156 KB Output is correct
7 Correct 2 ms 21156 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 40 ms 21156 KB Output is correct
2 Correct 27 ms 21156 KB Output is correct
3 Correct 182 ms 21156 KB Output is correct
4 Correct 2 ms 21156 KB Output is correct
5 Correct 7 ms 21156 KB Output is correct
6 Correct 12 ms 21156 KB Output is correct
7 Correct 2 ms 21156 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 53 ms 21156 KB Output is correct
2 Correct 133 ms 21156 KB Output is correct
3 Correct 130 ms 21156 KB Output is correct
4 Correct 2 ms 21156 KB Output is correct
5 Correct 46 ms 21156 KB Output is correct
6 Correct 173 ms 21240 KB Output is correct
7 Correct 2 ms 21240 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 283 ms 21240 KB Output is correct
2 Correct 27 ms 21240 KB Output is correct
3 Correct 9 ms 21240 KB Output is correct
4 Correct 2 ms 21240 KB Output is correct
5 Correct 6 ms 21240 KB Output is correct
6 Correct 151 ms 21240 KB Output is correct
7 Correct 2 ms 21240 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 26 ms 21240 KB Output is correct
2 Correct 83 ms 21240 KB Output is correct
3 Correct 9 ms 21240 KB Output is correct
4 Correct 8 ms 21240 KB Output is correct
5 Correct 48 ms 21240 KB Output is correct
6 Correct 18 ms 21240 KB Output is correct
7 Correct 2 ms 21240 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 329 ms 21292 KB Output is correct
2 Correct 28 ms 21292 KB Output is correct
3 Correct 9 ms 21292 KB Output is correct
4 Correct 405 ms 21296 KB Output is correct
5 Correct 63 ms 21296 KB Output is correct
6 Correct 11 ms 21296 KB Output is correct
7 Correct 2 ms 21296 KB Output is correct