Submission #43509

# Submission time Handle Problem Language Result Execution time Memory
43509 2018-03-16T19:54:01 Z XmtosX Ice Hockey World Championship (CEOI15_bobek) C++14
100 / 100
466 ms 25380 KB
#include <bits//stdc++.h>
using namespace std;
const int mod=1e9+7;
int n;
long long m,a[50];
vector <long long> v1,v2;
void bt (int pos,int x,long long sum)
{
    if (pos==x)
    {
        if (x==n)
            v2.push_back(sum);
        else
            v1.push_back(sum);
        return;
    }
    bt(pos+1,x,sum);
    bt(pos+1,x,sum+a[pos]);
}
int main()
{
    cin >>n>>m;
    for (int i=0;i<n;i++)
        cin >>a[i];
    v2.push_back(m+1);
    bt(0,n/2,0);
    bt(n/2,n,0);
    sort(v2.begin(),v2.end());
    long long ans=0;
    for (int i=0;i<v1.size();i++)
    {
        long long x=(m-v1[i]);
        ans+= ((upper_bound(v2.begin(),v2.end(),x)-v2.begin()));
    }
    cout <<ans;
    return 0;
}

Compilation message

bobek.cpp: In function 'int main()':
bobek.cpp:30:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i=0;i<v1.size();i++)
                   ^
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 352 KB Output is correct
2 Correct 1 ms 428 KB Output is correct
3 Correct 2 ms 440 KB Output is correct
4 Correct 1 ms 496 KB Output is correct
5 Correct 2 ms 496 KB Output is correct
6 Correct 2 ms 496 KB Output is correct
7 Correct 1 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 564 KB Output is correct
2 Correct 1 ms 564 KB Output is correct
3 Correct 1 ms 600 KB Output is correct
4 Correct 1 ms 600 KB Output is correct
5 Correct 2 ms 600 KB Output is correct
6 Correct 1 ms 604 KB Output is correct
7 Correct 1 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 604 KB Output is correct
2 Correct 1 ms 604 KB Output is correct
3 Correct 1 ms 604 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
5 Correct 2 ms 604 KB Output is correct
6 Correct 2 ms 604 KB Output is correct
7 Correct 1 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 25 ms 3280 KB Output is correct
2 Correct 96 ms 6852 KB Output is correct
3 Correct 424 ms 25268 KB Output is correct
4 Correct 89 ms 25268 KB Output is correct
5 Correct 11 ms 25268 KB Output is correct
6 Correct 6 ms 25268 KB Output is correct
7 Correct 11 ms 25268 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 39 ms 25268 KB Output is correct
2 Correct 27 ms 25268 KB Output is correct
3 Correct 183 ms 25268 KB Output is correct
4 Correct 1 ms 25268 KB Output is correct
5 Correct 5 ms 25268 KB Output is correct
6 Correct 10 ms 25268 KB Output is correct
7 Correct 10 ms 25268 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 63 ms 25268 KB Output is correct
2 Correct 130 ms 25268 KB Output is correct
3 Correct 127 ms 25268 KB Output is correct
4 Correct 1 ms 25268 KB Output is correct
5 Correct 48 ms 25268 KB Output is correct
6 Correct 199 ms 25268 KB Output is correct
7 Correct 69 ms 25268 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 292 ms 25268 KB Output is correct
2 Correct 25 ms 25268 KB Output is correct
3 Correct 9 ms 25268 KB Output is correct
4 Correct 2 ms 25268 KB Output is correct
5 Correct 7 ms 25268 KB Output is correct
6 Correct 170 ms 25268 KB Output is correct
7 Correct 10 ms 25268 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 25 ms 25268 KB Output is correct
2 Correct 95 ms 25268 KB Output is correct
3 Correct 8 ms 25268 KB Output is correct
4 Correct 8 ms 25268 KB Output is correct
5 Correct 72 ms 25268 KB Output is correct
6 Correct 19 ms 25268 KB Output is correct
7 Correct 185 ms 25380 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 338 ms 25380 KB Output is correct
2 Correct 30 ms 25380 KB Output is correct
3 Correct 9 ms 25380 KB Output is correct
4 Correct 466 ms 25380 KB Output is correct
5 Correct 74 ms 25380 KB Output is correct
6 Correct 10 ms 25380 KB Output is correct
7 Correct 20 ms 25380 KB Output is correct