Submission #1110485

# Submission time Handle Problem Language Result Execution time Memory
1110485 2024-11-09T14:29:28 Z idk__ Ice Hockey World Championship (CEOI15_bobek) C++14
0 / 100
303 ms 33740 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
vector<int>sum1, sum2;
int n, x;
int a[41];
void f1(int i, int sum){
    if(i==n/2){
        sum1.push_back(sum);
        return;
    }
    f1(i+1, sum+a[i]);
    f1(i+1, sum);
}

void f2(int i, int sum){
    if(i==n){
        sum2.push_back(sum);
        return;
    }
    f2(i+1, sum+a[i]);
    f2(i+1, sum);
}

signed main() {
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

cin >> n >> x;
for(int i = 0;i < n; i++)cin >> a[i];
f1(0, 0);
f2(n/2, 0);
sort(sum2.begin(), sum2.end());
int ans = 0;
for(auto i : sum1){
    int idx = (upper_bound(sum2.begin(), sum2.end(), x-i) - sum2.begin());
    auto it = upper_bound(sum2.begin(), sum2.end(), x-i);
    ans += idx ;
}
cout << endl;
for(auto i : sum2)cout << i << " ";
cout << ans << endl;


}

Compilation message

bobek.cpp: In function 'int main()':
bobek.cpp:36:10: warning: variable 'it' set but not used [-Wunused-but-set-variable]
   36 |     auto it = upper_bound(sum2.begin(), sum2.end(), x-i);
      |          ^~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 24 ms 2640 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 34 ms 3408 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 60 ms 5440 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 303 ms 29616 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 4176 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 294 ms 33740 KB Output isn't correct
2 Halted 0 ms 0 KB -