답안 #461151

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
461151 2021-08-09T12:49:34 Z vanic Ice Hockey World Championship (CEOI15_bobek) C++14
40 / 100
1000 ms 296 KB
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>

using namespace std;

typedef long long ll;

const int maxn=45;

ll a[maxn];
ll pref[maxn];
ll sol;

void rijesi(int x, ll sum){
	if(sum<0){
		return;
	}
	if(sum>=pref[x+1]){
		sol+=(1ll<<(x+1));
		return;
	}
	sol++;
	for(int i=x; i>-1; i--){
		rijesi(i-1, sum-a[i]);
	}
}

int main(){
	int n;
	ll m;
	scanf("%d%lld", &n, &m);
	for(int i=0; i<n; i++){
		scanf("%lld", a+i);
	}
	sort(a, a+n);
	for(int i=0; i<n; i++){
		pref[i+1]=pref[i]+a[i];
	}
	rijesi(n-1, m);
	printf("%lld\n", sol);
	return 0;
}

Compilation message

bobek.cpp: In function 'int main()':
bobek.cpp:34:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   34 |  scanf("%d%lld", &n, &m);
      |  ~~~~~^~~~~~~~~~~~~~~~~~
bobek.cpp:36:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   36 |   scanf("%lld", a+i);
      |   ~~~~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 292 KB Output is correct
2 Correct 1 ms 292 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 288 KB Output is correct
7 Correct 1 ms 296 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1083 ms 204 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1087 ms 204 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1085 ms 204 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1073 ms 204 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 765 ms 272 KB Output is correct
2 Execution timed out 1081 ms 204 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1061 ms 224 KB Time limit exceeded
2 Halted 0 ms 0 KB -