# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
436172 | cpp219 | Ice Hockey World Championship (CEOI15_bobek) | C++14 | 447 ms | 20852 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#pragma GCC optimization O2
#pragma GCC optimization "unroll-loop"
#pragma target ("avx2")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define fs first
#define sc second
using namespace std;
typedef pair<ll,ll> LL;
const ll N = 40 + 9;
const ll inf = 1e9 + 7;
vector<ll> v1,v2;
ll n,k,now,ans,a[N];
void f1(ll i){
if (i > n/2){
if (now <= k) v1.push_back(now);
return;
}
f1(i + 1); now += a[i]; f1(i + 1); now -= a[i];
}
void f2(ll i){
if (i > n){
if (now <= k) v2.push_back(now);
return;
}
f2(i + 1); now += a[i]; f2(i + 1); now -= a[i];
}
int main(){
ios_base::sync_with_stdio(NULL); cin.tie(0); cout.tie(0);
#define task "test"
if (fopen(task".INP","r")){
freopen(task".INP","r",stdin);
//freopen(task".OUT","w",stdout);
}
cin>>n>>k;
for (ll i = 1;i <= n;i++) cin>>a[i];
f1(1); now = 0; f2(n/2 + 1);
//for (auto i : v2) cout<<i<<" "; return 0;
sort(v2.begin(),v2.end());
for (auto i : v1){
ll inc = prev(upper_bound(v2.begin(),v2.end(),k - i)) - v2.begin() + 1;
//cout<<inc<<"x\n";
ans += inc;
}
cout<<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... |