답안 #1110487

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1110487 2024-11-09T14:29:49 Z idk__ Ice Hockey World Championship (CEOI15_bobek) C++14
100 / 100
331 ms 22976 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 << 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);
      |          ^~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 504 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 2132 KB Output is correct
2 Correct 75 ms 6600 KB Output is correct
3 Correct 331 ms 22976 KB Output is correct
4 Correct 70 ms 6600 KB Output is correct
5 Correct 7 ms 1744 KB Output is correct
6 Correct 4 ms 1112 KB Output is correct
7 Correct 7 ms 1488 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 3020 KB Output is correct
2 Correct 19 ms 2128 KB Output is correct
3 Correct 131 ms 12740 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 3 ms 1104 KB Output is correct
6 Correct 10 ms 1744 KB Output is correct
7 Correct 7 ms 1620 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 46 ms 4688 KB Output is correct
2 Correct 92 ms 8780 KB Output is correct
3 Correct 90 ms 8780 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 35 ms 8780 KB Output is correct
6 Correct 108 ms 22976 KB Output is correct
7 Correct 48 ms 8948 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 186 ms 14920 KB Output is correct
2 Correct 19 ms 2132 KB Output is correct
3 Correct 6 ms 1272 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 4 ms 1104 KB Output is correct
6 Correct 107 ms 14920 KB Output is correct
7 Correct 8 ms 1744 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 21 ms 2300 KB Output is correct
2 Correct 70 ms 6600 KB Output is correct
3 Correct 5 ms 1104 KB Output is correct
4 Correct 5 ms 1108 KB Output is correct
5 Correct 37 ms 8792 KB Output is correct
6 Correct 12 ms 2300 KB Output is correct
7 Correct 106 ms 22976 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 224 ms 22976 KB Output is correct
2 Correct 20 ms 2144 KB Output is correct
3 Correct 6 ms 1104 KB Output is correct
4 Correct 314 ms 22976 KB Output is correct
5 Correct 51 ms 12524 KB Output is correct
6 Correct 7 ms 1620 KB Output is correct
7 Correct 13 ms 2924 KB Output is correct