# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
858957 | Tenis0206 | Ice Hockey World Championship (CEOI15_bobek) | C++11 | 291 ms | 22712 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int nmax = 40;
int n,m;
int v[nmax + 5];
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cin>>n>>m;
for(int i=1;i<=n;i++)
{
cin>>v[i];
}
int sz_a = n / 2;
int sz_b = n - sz_a;
vector<long long> a,b;
for(int mask=0;mask<(1<<sz_a);mask++)
{
long long sum = 0;
for(int b=0;b<sz_a;b++)
{
if((mask & (1<<b))!=0)
{
sum += v[b + 1];
}
}
a.push_back(sum);
}
for(int mask=0;mask<(1<<sz_b);mask++)
{
long long sum = 0;
for(int b=0;b<sz_b;b++)
{
if((mask & (1<<b))!=0)
{
sum += v[sz_a + b + 1];
}
}
b.push_back(sum);
}
sort(a.begin(),a.end());
sort(b.begin(),b.end());
int poz = b.size() - 1;
long long rez = 0;
for(int i=0;i<a.size();i++)
{
while(poz >= 0 && a[i] + b[poz] > m)
{
--poz;
}
rez += poz + 1;
}
cout<<rez<<'\n';
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... |