답안 #658788

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
658788 2022-11-14T22:06:32 Z beaconmc Ice Hockey World Championship (CEOI15_bobek) C++14
100 / 100
346 ms 20812 KB
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;


#define FOR(i, x, y) for(ll i=x; i<y; i++)
#define FORNEG(i, x, y) for(ll i=x; i>y; i--)


ll sus[41];
int main(){
	ll a,b,n,m;

	vector<ll> aaa, bbb;
	vector<ll> aaa2,bbb2;

	cin >> n >> m;
	FOR(i,0,n) cin >> sus[i];

	a = n/2;
	b = (n-1)/2 + 1;

	FOR(i,0,1<<a){
		ll cur = 0, temp = 0, tempi = i;
		while (tempi){
			if (tempi&1) temp += sus[cur];
			cur++;
			tempi>>=1;
		}
		//aa[temp] += 1;
		aaa.push_back(temp);
	}



	FOR(i,0,1<<b){
		ll cur = a, temp = 0, tempi = i;
		while (tempi){
			if (tempi&1) temp += sus[cur];
			cur++;
			tempi>>=1;
		}

		//bb[temp] += 1;
		bbb.push_back(temp);
	}

	sort(aaa.begin(), aaa.end());
	sort(bbb.begin(), bbb.end());

	ll ans = 0;

	FOR(i,0,aaa.size()){

		if (m-aaa[i] < 0) continue;

		ll lower = upper_bound(bbb.begin(), bbb.end(), m-aaa[i]) - bbb.begin();

		ans += lower;
	}
	cout << ans;

}

Compilation message

bobek.cpp: In function 'int main()':
bobek.cpp:7:35: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    7 | #define FOR(i, x, y) for(ll i=x; i<y; i++)
......
   54 |  FOR(i,0,aaa.size()){
      |      ~~~~~~~~~~~~~~                
bobek.cpp:54:2: note: in expansion of macro 'FOR'
   54 |  FOR(i,0,aaa.size()){
      |  ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 1872 KB Output is correct
2 Correct 76 ms 5384 KB Output is correct
3 Correct 346 ms 20732 KB Output is correct
4 Correct 75 ms 5404 KB Output is correct
5 Correct 14 ms 1484 KB Output is correct
6 Correct 8 ms 852 KB Output is correct
7 Correct 15 ms 1484 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 40 ms 2768 KB Output is correct
2 Correct 29 ms 1948 KB Output is correct
3 Correct 122 ms 10428 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 6 ms 932 KB Output is correct
6 Correct 16 ms 1484 KB Output is correct
7 Correct 15 ms 1588 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 56 ms 3532 KB Output is correct
2 Correct 123 ms 6544 KB Output is correct
3 Correct 122 ms 6580 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 69 ms 6588 KB Output is correct
6 Correct 273 ms 20796 KB Output is correct
7 Correct 100 ms 6492 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 228 ms 12700 KB Output is correct
2 Correct 25 ms 1872 KB Output is correct
3 Correct 9 ms 852 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 6 ms 852 KB Output is correct
6 Correct 232 ms 12716 KB Output is correct
7 Correct 15 ms 1484 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 26 ms 1872 KB Output is correct
2 Correct 75 ms 5420 KB Output is correct
3 Correct 8 ms 964 KB Output is correct
4 Correct 8 ms 852 KB Output is correct
5 Correct 75 ms 6592 KB Output is correct
6 Correct 26 ms 1872 KB Output is correct
7 Correct 280 ms 20772 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 324 ms 20812 KB Output is correct
2 Correct 27 ms 1872 KB Output is correct
3 Correct 9 ms 848 KB Output is correct
4 Correct 322 ms 20740 KB Output is correct
5 Correct 106 ms 10512 KB Output is correct
6 Correct 18 ms 1484 KB Output is correct
7 Correct 32 ms 2880 KB Output is correct