답안 #1005047

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1005047 2024-06-22T06:39:27 Z Rifal Ice Hockey World Championship (CEOI15_bobek) C++14
100 / 100
380 ms 10544 KB
#include <bits/stdc++.h>
#include <fstream>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define endl '\n'
#define mod 1000000007
#define INF 1000000000
#define INF2 2000000000
#define fi first
#define se second
using namespace std;
double const EPS = 1e-14;
const int P = 1007;
typedef long long ll;
using namespace __gnu_pbds;
typedef long long ll;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; // find_by_order, order_of_key
map<ll,ll> mp;
int main()
{
    ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);
    int n; cin >> n; ll val; cin >> val; ll arr[n];
    for(int i = 0; i < n; i++) cin >> arr[i];
    int mid = n/2;
    vector<ll> v;
    for(int i = 0; i < (1<<mid); i++) {
        ll sum = 0;
        for(int j = 0; j < mid; j++) {
            if((i&(1<<j)) > 0) {
                sum += arr[j];
            }
        }
        v.push_back(sum);
    }
    sort(v.begin(),v.end());
    ll ans = 0;
    for(int i = 0; i < (1<<(n-mid)); i++) {
        ll sum = 0;
        for(int j = 0; j < (n-mid); j++) {
            if((i&(1<<j)) > 0) {
                sum += arr[j+mid];
            }
        }
        int indx = upper_bound(v.begin(),v.end(),val-sum)-v.begin();
        ans += indx;
    }
    cout << ans << endl;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 992 KB Output is correct
2 Correct 81 ms 2520 KB Output is correct
3 Correct 380 ms 9152 KB Output is correct
4 Correct 78 ms 2516 KB Output is correct
5 Correct 12 ms 988 KB Output is correct
6 Correct 6 ms 736 KB Output is correct
7 Correct 12 ms 992 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 34 ms 1500 KB Output is correct
2 Correct 26 ms 992 KB Output is correct
3 Correct 163 ms 6100 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 6 ms 736 KB Output is correct
6 Correct 12 ms 992 KB Output is correct
7 Correct 12 ms 992 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 57 ms 1500 KB Output is correct
2 Correct 137 ms 2516 KB Output is correct
3 Correct 125 ms 2516 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 70 ms 2440 KB Output is correct
6 Correct 186 ms 9156 KB Output is correct
7 Correct 70 ms 2520 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 296 ms 6356 KB Output is correct
2 Correct 25 ms 988 KB Output is correct
3 Correct 8 ms 736 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 6 ms 732 KB Output is correct
6 Correct 145 ms 6360 KB Output is correct
7 Correct 12 ms 992 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 29 ms 992 KB Output is correct
2 Correct 75 ms 2520 KB Output is correct
3 Correct 7 ms 732 KB Output is correct
4 Correct 8 ms 736 KB Output is correct
5 Correct 76 ms 2520 KB Output is correct
6 Correct 17 ms 992 KB Output is correct
7 Correct 204 ms 9468 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 320 ms 10544 KB Output is correct
2 Correct 26 ms 1240 KB Output is correct
3 Correct 8 ms 736 KB Output is correct
4 Correct 367 ms 9692 KB Output is correct
5 Correct 98 ms 4820 KB Output is correct
6 Correct 12 ms 988 KB Output is correct
7 Correct 24 ms 1500 KB Output is correct