답안 #208153

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
208153 2020-03-10T06:32:02 Z HeydarBABA Ice Hockey World Championship (CEOI15_bobek) C++14
50 / 100
216 ms 16760 KB
#include<bits/stdc++.h>
using namespace std;

const int maxn = 40;
const int maxc = (1 << 20) + 10;

int A, B;
int n, m;
int a[maxn];
int b[maxn];
long long a2[maxc];
long long b2[maxc];
long long ans;

void in();
void solve();
void out();

int main(){
    in();
    solve();
    out();
}

void in(){
    ios::sync_with_stdio(false);
    cin >> n >> m;
    for(int i = 0; i < n / 2; i++)
        cin >> a[i + 1];
    A = n / 2;
    for(int i = n / 2; i < n; i++)
        cin >> b[i - n / 2 + 1];
    B = n - A;
}

void solve(){
    for(int i = 1; i < (1 << A); i++){
        a2[i] = a2[i - (i & -i)];
        a2[i] += a[__builtin_ctz(i) + 1];
    }
    for(int i = 1; i < (1 << B); i++){
        b2[i] = b2[i - (i & -i)];
        b2[i] += b[__builtin_ctz(i) + 1];
    }
    sort(a2, a2 + (1 << A));
    sort(b2, b2 + (1 << B));
    A = 1 << A;
    B = 1 << B;
    int nowb = B - 1;
    for(int i = 0; i < A; i++){
        while(nowb != -1 && b2[nowb] + a2[i] > m)
            nowb--;
        ans += nowb + 1;
    }
}

void out(){
    cout << ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 5 ms 380 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 20 ms 1912 KB Output is correct
2 Correct 54 ms 4600 KB Output is correct
3 Correct 216 ms 16760 KB Output is correct
4 Correct 53 ms 4472 KB Output is correct
5 Correct 10 ms 1400 KB Output is correct
6 Correct 9 ms 940 KB Output is correct
7 Correct 15 ms 1400 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 27 ms 2552 KB Output is correct
2 Correct 22 ms 1912 KB Output is correct
3 Correct 78 ms 8568 KB Output is correct
4 Correct 4 ms 376 KB Output is correct
5 Correct 7 ms 888 KB Output is correct
6 Correct 15 ms 1400 KB Output is correct
7 Correct 15 ms 1400 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 42 ms 3448 KB Output is correct
2 Correct 80 ms 6556 KB Output is correct
3 Correct 76 ms 6524 KB Output is correct
4 Correct 5 ms 380 KB Output is correct
5 Correct 34 ms 6520 KB Output is correct
6 Correct 164 ms 16760 KB Output is correct
7 Correct 78 ms 6572 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 34 ms 12664 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 1912 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 52 ms 16760 KB Output isn't correct
2 Halted 0 ms 0 KB -