# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
221903 | MKopchev | Ice Hockey World Championship (CEOI15_bobek) | C++14 | 389 ms | 8576 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
const int nmax=50,MX=(1<<20)+42;
int n;
long long m,inp[nmax];
long long seen[MX];
int pointer=0;
long long output;
void dfs_1(int pos,int target,long long current)
{
if(current>m)return;
if(pos>target)
{
pointer++;
seen[pointer]=current;
return;
}
dfs_1(pos+1,target,current);
dfs_1(pos+1,target,current+inp[pos]);
}
void dfs_2(int pos,int target,long long current)
{
if(current>m)return;
if(pos>target)
{
int pos=upper_bound(seen+1,seen+pointer+1,m-current)-seen;
output=output+pos-1;
return;
}
dfs_2(pos+1,target,current);
dfs_2(pos+1,target,current+inp[pos]);
}
int main()
{
scanf("%i%lld",&n,&m);
for(int i=1;i<=n;i++)scanf("%lld",&inp[i]);
dfs_1(1,n/2,0);
sort(seen+1,seen+pointer+1);
dfs_2(n/2+1,n,0);
printf("%lld\n",output);
return 0;
}
컴파일 시 표준 에러 (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... |