답안 #101292

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
101292 2019-03-18T07:45:32 Z arman_ferdous Bali Sculptures (APIO15_sculpture) C++17
0 / 100
3 ms 256 KB
#include <bits/stdc++.h>
using namespace std;

using ll = long long;

int main() {
	int n, A, B;
	ll arr[22];
	scanf("%d %d", &n, &A, &B);
	for(int i = 0; i < n; i++)
		scanf("%lld", &arr[i]);
	ll ans = (1ll<<62);
	for(int mask = 0; mask < (1<<n); mask++) {

		ll here = 0, cnt = 0;
		for(int i = 0; i < n; ) {
			ll sum = 0;
			for(int j = i; j < n; j++, i++) {
				sum += arr[j];
				if(mask>>j&1) { i++; cnt++; break; }
			}
			here |= sum;
		}
		if(A <= cnt && cnt <= B) ans = min(ans, here);
	} printf("%lld\n", ans);
	return 0;
}

Compilation message

sculpture.cpp: In function 'int main()':
sculpture.cpp:9:27: warning: too many arguments for format [-Wformat-extra-args]
  scanf("%d %d", &n, &A, &B);
                           ^
sculpture.cpp:9:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d", &n, &A, &B);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~
sculpture.cpp:11:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld", &arr[i]);
   ~~~~~^~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -