답안 #1054108

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1054108 2024-08-12T06:31:29 Z matere Ice Hockey World Championship (CEOI15_bobek) C++14
100 / 100
255 ms 22488 KB
#include<bits/stdc++.h>
using namespace std;
long long n,n1,n2,m,a[21],b[21];
vector<long long>v1,v2;
int main(){
    cin>>n>>m;
    n1=n/2;
    n2=n-n/2;
    for(int i=1;i<=n1;i++){
        cin>>a[i];
    }
    for(int i=1;i<=n2;i++){
        cin>>b[i];
    }
    for(int i=0;i<(1ll<<n1);i++){
        long long sum=0;
        for(int j=0;j<n1;j++){
            if(i&(1ll<<j)){
                sum+=a[j+1];
            }
        }
        v1.push_back(sum);
    }
    for(int i=0;i<(1ll<<n2);i++){
        long long sum=0;
        for(int j=0;j<n2;j++){
            if(i&(1ll<<j)){
                sum+=b[j+1];
            }
        }
        v2.push_back(sum);
    }
    sort(v1.begin(),v1.end());
    sort(v2.begin(),v2.end());
    long long ans=0;
    for(long long i:v1){
        ans+=upper_bound(v2.begin(),v2.end(),m-i)-v2.begin();
    }
    cout<<ans<<endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 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 344 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 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 23 ms 1880 KB Output is correct
2 Correct 61 ms 5312 KB Output is correct
3 Correct 255 ms 21680 KB Output is correct
4 Correct 59 ms 5580 KB Output is correct
5 Correct 11 ms 1488 KB Output is correct
6 Correct 6 ms 984 KB Output is correct
7 Correct 13 ms 1508 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 27 ms 2768 KB Output is correct
2 Correct 21 ms 1880 KB Output is correct
3 Correct 100 ms 11012 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 5 ms 1032 KB Output is correct
6 Correct 13 ms 1696 KB Output is correct
7 Correct 13 ms 1672 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 43 ms 3668 KB Output is correct
2 Correct 86 ms 7492 KB Output is correct
3 Correct 87 ms 7244 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 58 ms 8136 KB Output is correct
6 Correct 220 ms 22488 KB Output is correct
7 Correct 83 ms 7320 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 181 ms 13116 KB Output is correct
2 Correct 22 ms 1880 KB Output is correct
3 Correct 7 ms 984 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 5 ms 984 KB Output is correct
6 Correct 171 ms 12948 KB Output is correct
7 Correct 13 ms 1492 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 21 ms 2124 KB Output is correct
2 Correct 58 ms 5580 KB Output is correct
3 Correct 7 ms 984 KB Output is correct
4 Correct 7 ms 1096 KB Output is correct
5 Correct 61 ms 8188 KB Output is correct
6 Correct 20 ms 1880 KB Output is correct
7 Correct 239 ms 21796 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 243 ms 22444 KB Output is correct
2 Correct 23 ms 1880 KB Output is correct
3 Correct 7 ms 984 KB Output is correct
4 Correct 248 ms 21676 KB Output is correct
5 Correct 86 ms 11456 KB Output is correct
6 Correct 13 ms 1652 KB Output is correct
7 Correct 26 ms 2780 KB Output is correct