답안 #130716

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
130716 2019-07-16T02:35:10 Z nandonathaniel Ice Hockey World Championship (CEOI15_bobek) C++14
100 / 100
426 ms 20948 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL MOD=1000000007;

vector<LL> pertama,kedua;
LL a[25],b[25];

int main(){
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	LL n,m,ans=0;
	cin >> n >> m;
	LL first=n/2,second=n-first;
	for(LL i=0;i<first;i++)cin >> a[i];
	for(LL i=0;i<second;i++)cin >> b[i];
	for(LL i=0;i<(1<<first);i++){
		LL brp=0;
		for(LL j=0;j<first;j++){
			if(i & (1<<j))brp+=a[j];
		}
		pertama.push_back(brp);
	}
	for(LL i=0;i<(1<<second);i++){
		LL brp=0;
		for(LL j=0;j<second;j++){
			if(i & (1<<j))brp+=b[j];
		}
		kedua.push_back(brp);
	}
	sort(pertama.begin(),pertama.end());
	sort(kedua.begin(),kedua.end());
	reverse(kedua.begin(),kedua.end());
	LL j=0;
	for(LL i=0;i<pertama.size();i++){
		while(j<kedua.size() && kedua[j]+pertama[i]>m)j++;
		ans+=(kedua.size()-j);
	}
	cout << ans << endl;
	return 0;
}

Compilation message

bobek.cpp: In function 'int main()':
bobek.cpp:34:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(LL i=0;i<pertama.size();i++){
             ~^~~~~~~~~~~~~~~
bobek.cpp:35:10: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   while(j<kedua.size() && kedua[j]+pertama[i]>m)j++;
         ~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 508 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 380 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 34 ms 2036 KB Output is correct
2 Correct 99 ms 5484 KB Output is correct
3 Correct 426 ms 20856 KB Output is correct
4 Correct 98 ms 5480 KB Output is correct
5 Correct 19 ms 1652 KB Output is correct
6 Correct 12 ms 1016 KB Output is correct
7 Correct 25 ms 1652 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 46 ms 2928 KB Output is correct
2 Correct 36 ms 2036 KB Output is correct
3 Correct 175 ms 10592 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 11 ms 1012 KB Output is correct
6 Correct 24 ms 1648 KB Output is correct
7 Correct 24 ms 1736 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 73 ms 3552 KB Output is correct
2 Correct 150 ms 6660 KB Output is correct
3 Correct 156 ms 6752 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 105 ms 6636 KB Output is correct
6 Correct 367 ms 20824 KB Output is correct
7 Correct 147 ms 6628 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 309 ms 12840 KB Output is correct
2 Correct 38 ms 2036 KB Output is correct
3 Correct 13 ms 1016 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 10 ms 1016 KB Output is correct
6 Correct 314 ms 13004 KB Output is correct
7 Correct 23 ms 1652 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 37 ms 2036 KB Output is correct
2 Correct 97 ms 5512 KB Output is correct
3 Correct 13 ms 1016 KB Output is correct
4 Correct 13 ms 1016 KB Output is correct
5 Correct 112 ms 6752 KB Output is correct
6 Correct 38 ms 2036 KB Output is correct
7 Correct 412 ms 20820 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 414 ms 20904 KB Output is correct
2 Correct 37 ms 2160 KB Output is correct
3 Correct 13 ms 1016 KB Output is correct
4 Correct 425 ms 20948 KB Output is correct
5 Correct 147 ms 10592 KB Output is correct
6 Correct 25 ms 1656 KB Output is correct
7 Correct 51 ms 2924 KB Output is correct