답안 #118779

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
118779 2019-06-19T17:42:33 Z silxikys Ice Hockey World Championship (CEOI15_bobek) C++14
컴파일 오류
0 ms 0 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';
}

Compilation message

bobek.cpp:13:1: error: expected initializer before 'll'
 ll M;
 ^~
bobek.cpp: In function 'int main()':
bobek.cpp:18:9: error: 'N' was not declared in this scope
  cin >> N >> M;
         ^
bobek.cpp:18:14: error: 'M' was not declared in this scope
  cin >> N >> M;
              ^