답안 #118780

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
118780 2019-06-19T17:43:49 Z silxikys Ice Hockey World Championship (CEOI15_bobek) C++14
40 / 100
1000 ms 64504 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

const int maxn = 45;

template <class K, class V = __gnu_pbds::null_type>
using ordered_multiset = __gnu_pbds::tree<K, V, std::less_equal<K>, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>;

int N;
ll M;
ll A[maxn], B[maxn];

int main()
{
	cin >> N >> M;
	int split = N/2;
	for (int i = 0; i < split; i++) {
		cin >> A[i];
	}
    for (int i = split; i < N; i++) {
        cin >> B[i-split];
    }
    ordered_multiset<ll> s;
	for (int i = 0; i < (1<<split); i++) {
        ll total = 0;
        for (int j = 0; j < split; j++) {
            if (i & (1<<j)) total += A[j];
        }
        s.insert(total);
    }

    ll ans = 0;
    for (int i = 0; i < (1<<(N-split)); i++) {
        ll total = 0;
        for (int j = 0; j < N-split; j++) {
            if (i & (1<<j)) total += B[j];
        }
        if (total <= M) {
            ans += s.order_of_key(M-total+1);
        }
    }
    cout << ans << '\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 80 ms 4496 KB Output is correct
2 Correct 409 ms 16812 KB Output is correct
3 Execution timed out 1053 ms 59448 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 147 ms 8568 KB Output is correct
2 Correct 95 ms 4344 KB Output is correct
3 Execution timed out 1073 ms 33276 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 231 ms 8568 KB Output is correct
2 Correct 676 ms 16780 KB Output is correct
3 Correct 665 ms 16760 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 274 ms 16892 KB Output is correct
6 Execution timed out 1039 ms 50408 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1075 ms 33092 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 82 ms 4472 KB Output is correct
2 Correct 470 ms 16760 KB Output is correct
3 Correct 24 ms 2304 KB Output is correct
4 Correct 22 ms 2304 KB Output is correct
5 Correct 372 ms 16772 KB Output is correct
6 Correct 61 ms 4344 KB Output is correct
7 Execution timed out 1082 ms 64504 KB Time limit exceeded
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1036 ms 57644 KB Time limit exceeded
2 Halted 0 ms 0 KB -