| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 374225 | MilosMilutinovic | Ice Hockey World Championship (CEOI15_bobek) | C++14 | 546 ms | 8812 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++;
}
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];
}
int bot=0,top=(int)all.size()-1,pos=0;
ll need=m-sum;
while(bot<=top){
int mid=bot+top>>1;
if(all[mid]<=need)pos=mid+1,bot=mid+1;
else top=mid-1;
}
ans+=pos;
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... | ||||
