# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
680959 | Cross_Ratio | Ice Hockey World Championship (CEOI15_bobek) | C++14 | 108 ms | 17400 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define int long long
using namespace std;
int A[45];
vector<int> B, C;
signed main() {
cin.sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int N, M;
cin >> N >> M;
int i, j;
for(i=0;i<N;i++) cin >> A[i];
B.push_back(0);
for(i=0;i<min(20LL, N);i++) {
int sz = B.size();
for(j=0;j<sz;j++) B.push_back(B[j] + A[i]);
}
C.push_back(0);
for(i=20;i<N;i++) {
int sz = C.size();
for(j=0;j<sz;j++) C.push_back(C[j] + A[j]);
}
sort(B.begin(),B.end());
sort(C.begin(),C.end());
j = (int)B.size() - 1;
int ans = 0;
for(i=0;i<C.size();i++) {
while(j>=0&&B[j]+C[i]>M) j--;
ans += j+1;
}
cout << ans;
}
Compilation message (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... |