답안 #249138

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
249138 2020-07-14T12:17:32 Z hunni10 Bali Sculptures (APIO15_sculpture) C++14
9 / 100
1000 ms 384 KB
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<math.h>
#include<string.h>
#include<queue>
#include<list>
#include<time.h>
#include<assert.h>
#include<unordered_set>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
int n, m, k, t;
int a, b;
int y[2000];
ll acc[2000];

vector<int> current_division;

int get() {
	int sum = 0;
	auto riter = current_division.rbegin();
	while (true) {
		if (riter + 1 == current_division.rend()) return 1;
		sum += *riter;
		*riter = 0;
		if (*(riter + 1) != 0) {
			(*(riter + 1))--;
			*riter = sum + 1;
			return 0;
		}
		riter++;
	}

	return 0;
}

int main() {
	scanf("%d %d %d", &n, &a, &b);
	ll sum = 0;
	for (int i = 0; i < n; i++) {
		scanf("%d", y + i);
		sum += y[i];
		acc[i] = sum;
	}
	ll mn = 0x7FFFFFFFFFFFFFFF;
	for (int d = a; d <= b; d++) {
		current_division.clear();
		current_division.assign(d, 0);
		current_division[0] = n - d;
		int stop = 0;
		while (!stop) {
			int idx = 0;
			ll ors = 0;
			for (int num : current_division) {
				ll subsum = acc[idx + num];
				if (idx != 0) {
					subsum -= acc[idx-1];
				}
				ors |= subsum;
				idx += num + 1;
			}
			if (mn > ors) mn = ors;
			stop = get();
		}
	}
	printf("%lld", mn);
}

Compilation message

sculpture.cpp: In function 'int main()':
sculpture.cpp:47:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d %d", &n, &a, &b);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
sculpture.cpp:50:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", y + i);
   ~~~~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 0 ms 256 KB Output is correct
8 Correct 0 ms 256 KB Output is correct
9 Correct 0 ms 256 KB Output is correct
10 Correct 0 ms 256 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 0 ms 256 KB Output is correct
13 Correct 12 ms 256 KB Output is correct
14 Correct 0 ms 256 KB Output is correct
15 Correct 0 ms 256 KB Output is correct
16 Correct 0 ms 256 KB Output is correct
17 Correct 1 ms 256 KB Output is correct
18 Correct 0 ms 256 KB Output is correct
19 Correct 0 ms 256 KB Output is correct
20 Correct 0 ms 256 KB Output is correct
21 Correct 1 ms 256 KB Output is correct
22 Correct 1 ms 256 KB Output is correct
23 Correct 1 ms 256 KB Output is correct
24 Correct 0 ms 256 KB Output is correct
25 Correct 1 ms 256 KB Output is correct
26 Correct 10 ms 256 KB Output is correct
27 Correct 0 ms 256 KB Output is correct
28 Correct 0 ms 256 KB Output is correct
29 Correct 0 ms 256 KB Output is correct
30 Correct 0 ms 256 KB Output is correct
31 Correct 1 ms 256 KB Output is correct
32 Correct 0 ms 256 KB Output is correct
33 Correct 11 ms 256 KB Output is correct
34 Correct 12 ms 256 KB Output is correct
35 Correct 0 ms 256 KB Output is correct
36 Correct 13 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 0 ms 256 KB Output is correct
8 Correct 0 ms 256 KB Output is correct
9 Correct 0 ms 256 KB Output is correct
10 Correct 0 ms 256 KB Output is correct
11 Correct 0 ms 256 KB Output is correct
12 Correct 0 ms 256 KB Output is correct
13 Correct 15 ms 256 KB Output is correct
14 Correct 0 ms 384 KB Output is correct
15 Correct 0 ms 256 KB Output is correct
16 Correct 0 ms 256 KB Output is correct
17 Correct 0 ms 256 KB Output is correct
18 Correct 0 ms 256 KB Output is correct
19 Correct 0 ms 256 KB Output is correct
20 Correct 0 ms 256 KB Output is correct
21 Correct 1 ms 256 KB Output is correct
22 Correct 1 ms 256 KB Output is correct
23 Correct 1 ms 256 KB Output is correct
24 Correct 0 ms 256 KB Output is correct
25 Correct 1 ms 256 KB Output is correct
26 Correct 11 ms 256 KB Output is correct
27 Correct 26 ms 256 KB Output is correct
28 Correct 48 ms 256 KB Output is correct
29 Correct 1 ms 256 KB Output is correct
30 Execution timed out 1093 ms 256 KB Time limit exceeded
31 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 0 ms 256 KB Output is correct
8 Correct 0 ms 256 KB Output is correct
9 Correct 0 ms 256 KB Output is correct
10 Correct 0 ms 256 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 0 ms 256 KB Output is correct
13 Correct 13 ms 256 KB Output is correct
14 Correct 25 ms 256 KB Output is correct
15 Correct 46 ms 256 KB Output is correct
16 Correct 1 ms 256 KB Output is correct
17 Execution timed out 1085 ms 256 KB Time limit exceeded
18 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 0 ms 256 KB Output is correct
8 Correct 0 ms 256 KB Output is correct
9 Correct 0 ms 256 KB Output is correct
10 Correct 0 ms 256 KB Output is correct
11 Correct 0 ms 256 KB Output is correct
12 Correct 0 ms 256 KB Output is correct
13 Correct 12 ms 256 KB Output is correct
14 Correct 0 ms 256 KB Output is correct
15 Correct 0 ms 256 KB Output is correct
16 Correct 0 ms 256 KB Output is correct
17 Correct 0 ms 256 KB Output is correct
18 Correct 0 ms 256 KB Output is correct
19 Correct 0 ms 256 KB Output is correct
20 Correct 0 ms 256 KB Output is correct
21 Correct 1 ms 256 KB Output is correct
22 Correct 1 ms 256 KB Output is correct
23 Correct 1 ms 256 KB Output is correct
24 Correct 0 ms 256 KB Output is correct
25 Correct 1 ms 256 KB Output is correct
26 Correct 11 ms 256 KB Output is correct
27 Correct 0 ms 256 KB Output is correct
28 Correct 0 ms 256 KB Output is correct
29 Correct 0 ms 256 KB Output is correct
30 Correct 0 ms 256 KB Output is correct
31 Correct 1 ms 256 KB Output is correct
32 Correct 1 ms 256 KB Output is correct
33 Correct 11 ms 256 KB Output is correct
34 Correct 12 ms 256 KB Output is correct
35 Correct 0 ms 256 KB Output is correct
36 Correct 12 ms 256 KB Output is correct
37 Correct 25 ms 256 KB Output is correct
38 Correct 55 ms 256 KB Output is correct
39 Correct 1 ms 256 KB Output is correct
40 Execution timed out 1090 ms 256 KB Time limit exceeded
41 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 0 ms 256 KB Output is correct
8 Correct 0 ms 256 KB Output is correct
9 Correct 0 ms 256 KB Output is correct
10 Correct 0 ms 256 KB Output is correct
11 Correct 0 ms 256 KB Output is correct
12 Correct 0 ms 256 KB Output is correct
13 Correct 12 ms 256 KB Output is correct
14 Correct 0 ms 256 KB Output is correct
15 Correct 0 ms 256 KB Output is correct
16 Correct 0 ms 256 KB Output is correct
17 Correct 0 ms 256 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
19 Correct 0 ms 256 KB Output is correct
20 Correct 10 ms 256 KB Output is correct
21 Correct 12 ms 256 KB Output is correct
22 Correct 0 ms 256 KB Output is correct
23 Correct 12 ms 256 KB Output is correct
24 Correct 25 ms 256 KB Output is correct
25 Correct 48 ms 256 KB Output is correct
26 Correct 1 ms 256 KB Output is correct
27 Execution timed out 1092 ms 256 KB Time limit exceeded
28 Halted 0 ms 0 KB -