| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 374224 | MilosMilutinovic | Ice Hockey World Championship (CEOI15_bobek) | C++14 | 550 ms | 8664 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
const int N=45;
ll a[N];
int main(){
int n;scanf("%i",&n);
ll m;scanf("%lld",&m);
for(int i=0;i<n;i++)scanf("%lld",&a[i]);
int b=n/2;
vector<ll> all;
ll ans=1;
for(int i=1;i<(1<<b);i++){
ll sum=0LL;
for(int j=0;j<b;j++){
if(i&(1<<j))sum+=a[j];
}
all.pb(sum);
if(sum<=m)ans++;
//printf("%lld\n",sum);
}
sort(all.begin(),all.end());
int sz=n-b;
auto Get=[&](ll x){
if(x>m)return 0;
return (int)(lower_bound(all.begin(),all.end(),m-x)-all.begin());
};
for(int i=1;i<(1<<sz);i++){
ll sum=0LL;
for(int j=0;j<sz;j++){
if(i&(1<<j))sum+=a[b+j];
}
//printf("%lld\n",sum);
ans+=Get(sum);
if(sum<=m)ans++;
}
printf("%lld",ans);
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
