Submission #25717

# Submission time Handle Problem Language Result Execution time Memory
25717 2017-06-23T19:03:44 Z gs14004 Ice Hockey World Championship (CEOI15_bobek) C++11
100 / 100
429 ms 25836 KB
#include <cstdio>
#include <vector>
#include <algorithm>
typedef long long lint;
using namespace std;
 
vector<lint> v1, v2;
 
lint a[41], m;
 
void dfs(lint x, int pos, int lim, vector<lint> &v){
    if(pos == lim){
        v.push_back(x);
        return;
    }
    dfs(x + a[pos], pos+1, lim, v);
    dfs(x, pos + 1, lim, v);
}
 
int n;
 
int main(){
    scanf("%d %lld",&n,&m);
    for(int i=0; i<n; i++){
        scanf("%lld",&a[i]);
    }
    dfs(0, 0, n/2, v1);
    dfs(0, n/2, n, v2);
    sort(v2.begin(), v2.end());
    lint ret = 0;
    for(auto &i : v1){
        ret += (int)(upper_bound(v2.begin(), v2.end(), m - i) - v2.begin());
    }
    printf("%lld",ret);
}

Compilation message

bobek.cpp: In function 'int main()':
bobek.cpp:23:27: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %lld",&n,&m);
                           ^
bobek.cpp:25:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld",&a[i]);
                            ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1176 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1176 KB Output is correct
2 Correct 0 ms 1176 KB Output is correct
3 Correct 0 ms 1176 KB Output is correct
4 Correct 0 ms 1176 KB Output is correct
5 Correct 0 ms 1176 KB Output is correct
6 Correct 0 ms 1176 KB Output is correct
7 Correct 0 ms 1176 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1176 KB Output is correct
2 Correct 0 ms 1176 KB Output is correct
3 Correct 0 ms 1176 KB Output is correct
4 Correct 0 ms 1176 KB Output is correct
5 Correct 0 ms 1176 KB Output is correct
6 Correct 0 ms 1176 KB Output is correct
7 Correct 0 ms 1176 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1176 KB Output is correct
2 Correct 0 ms 1176 KB Output is correct
3 Correct 0 ms 1176 KB Output is correct
4 Correct 0 ms 1176 KB Output is correct
5 Correct 0 ms 1176 KB Output is correct
6 Correct 0 ms 1176 KB Output is correct
7 Correct 0 ms 1176 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 23 ms 3312 KB Output is correct
2 Correct 89 ms 7404 KB Output is correct
3 Correct 396 ms 25836 KB Output is correct
4 Correct 89 ms 7404 KB Output is correct
5 Correct 3 ms 2796 KB Output is correct
6 Correct 3 ms 2028 KB Output is correct
7 Correct 6 ms 2796 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 36 ms 4332 KB Output is correct
2 Correct 23 ms 3312 KB Output is correct
3 Correct 179 ms 13548 KB Output is correct
4 Correct 0 ms 1176 KB Output is correct
5 Correct 0 ms 2028 KB Output is correct
6 Correct 9 ms 2796 KB Output is correct
7 Correct 6 ms 2796 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 56 ms 5360 KB Output is correct
2 Correct 119 ms 9456 KB Output is correct
3 Correct 116 ms 9456 KB Output is correct
4 Correct 0 ms 1176 KB Output is correct
5 Correct 33 ms 9456 KB Output is correct
6 Correct 153 ms 25836 KB Output is correct
7 Correct 66 ms 9456 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 273 ms 17648 KB Output is correct
2 Correct 26 ms 3312 KB Output is correct
3 Correct 6 ms 2028 KB Output is correct
4 Correct 0 ms 1176 KB Output is correct
5 Correct 3 ms 2028 KB Output is correct
6 Correct 156 ms 17648 KB Output is correct
7 Correct 6 ms 2796 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 19 ms 3312 KB Output is correct
2 Correct 89 ms 7404 KB Output is correct
3 Correct 6 ms 2028 KB Output is correct
4 Correct 3 ms 2028 KB Output is correct
5 Correct 53 ms 9456 KB Output is correct
6 Correct 16 ms 3312 KB Output is correct
7 Correct 156 ms 25836 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 323 ms 25836 KB Output is correct
2 Correct 26 ms 3312 KB Output is correct
3 Correct 6 ms 2028 KB Output is correct
4 Correct 429 ms 25836 KB Output is correct
5 Correct 53 ms 13548 KB Output is correct
6 Correct 6 ms 2796 KB Output is correct
7 Correct 13 ms 4332 KB Output is correct