답안 #597247

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
597247 2022-07-15T19:18:28 Z Belphegor Bali Sculptures (APIO15_sculpture) C++14
9 / 100
1000 ms 340 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll arr[22];
int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	int n,a,b; cin>>n>>a>>b;
	for(int i=0; i<n; i++) cin>>arr[i];
	ll ans = INT64_MAX;
	for(int i=1; i<(1<<n); i++){
		vector<int>v;
		for(int j=0; j<n; j++) if(i&(1<<j)) v.emplace_back(j);
		if(v.back()!=n-1) continue;
		if(v.size()<a || v.size()>b) continue;
		ll ret = 0;
		for(int j=0; j<=v[0]; j++) ret+=arr[j];
		for(int j=1; j<v.size(); j++){
			ll sum = 0;
			for(int k=v[j-1]+1; k<=v[j]; k++) sum+=arr[k];
			ret|=sum;
		}
		ans = min(ans,ret);
	}
	cout<<ans;
}

Compilation message

sculpture.cpp: In function 'int main()':
sculpture.cpp:14:14: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   14 |   if(v.size()<a || v.size()>b) continue;
      |      ~~~~~~~~^~
sculpture.cpp:14:28: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   14 |   if(v.size()<a || v.size()>b) continue;
      |                    ~~~~~~~~^~
sculpture.cpp:17:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |   for(int j=1; j<v.size(); j++){
      |                ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 7 ms 212 KB Output is correct
7 Correct 24 ms 300 KB Output is correct
8 Correct 210 ms 324 KB Output is correct
9 Correct 207 ms 300 KB Output is correct
10 Correct 197 ms 296 KB Output is correct
11 Correct 211 ms 304 KB Output is correct
12 Correct 204 ms 212 KB Output is correct
13 Correct 239 ms 300 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 7 ms 212 KB Output is correct
20 Correct 26 ms 212 KB Output is correct
21 Correct 202 ms 300 KB Output is correct
22 Correct 205 ms 308 KB Output is correct
23 Correct 243 ms 212 KB Output is correct
24 Correct 196 ms 300 KB Output is correct
25 Correct 199 ms 212 KB Output is correct
26 Correct 238 ms 296 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 2 ms 212 KB Output is correct
30 Correct 98 ms 304 KB Output is correct
31 Correct 194 ms 212 KB Output is correct
32 Correct 216 ms 212 KB Output is correct
33 Correct 238 ms 300 KB Output is correct
34 Correct 226 ms 304 KB Output is correct
35 Correct 199 ms 300 KB Output is correct
36 Correct 245 ms 304 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 320 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 320 KB Output is correct
6 Correct 8 ms 212 KB Output is correct
7 Correct 25 ms 212 KB Output is correct
8 Correct 244 ms 300 KB Output is correct
9 Correct 201 ms 304 KB Output is correct
10 Correct 212 ms 212 KB Output is correct
11 Correct 211 ms 304 KB Output is correct
12 Correct 200 ms 300 KB Output is correct
13 Correct 234 ms 308 KB Output is correct
14 Correct 1 ms 328 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 320 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 6 ms 212 KB Output is correct
20 Correct 24 ms 300 KB Output is correct
21 Correct 196 ms 300 KB Output is correct
22 Correct 209 ms 300 KB Output is correct
23 Correct 227 ms 212 KB Output is correct
24 Correct 200 ms 212 KB Output is correct
25 Correct 228 ms 304 KB Output is correct
26 Correct 228 ms 300 KB Output is correct
27 Correct 465 ms 296 KB Output is correct
28 Execution timed out 1083 ms 212 KB Time limit exceeded
29 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 324 KB Output is correct
6 Correct 10 ms 212 KB Output is correct
7 Correct 31 ms 300 KB Output is correct
8 Correct 199 ms 296 KB Output is correct
9 Correct 200 ms 332 KB Output is correct
10 Correct 197 ms 308 KB Output is correct
11 Correct 201 ms 300 KB Output is correct
12 Correct 222 ms 332 KB Output is correct
13 Correct 231 ms 304 KB Output is correct
14 Correct 480 ms 300 KB Output is correct
15 Execution timed out 1080 ms 212 KB Time limit exceeded
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 328 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 1 ms 212 KB Output is correct
6 Correct 7 ms 324 KB Output is correct
7 Correct 24 ms 212 KB Output is correct
8 Correct 208 ms 304 KB Output is correct
9 Correct 219 ms 300 KB Output is correct
10 Correct 197 ms 212 KB Output is correct
11 Correct 198 ms 304 KB Output is correct
12 Correct 249 ms 304 KB Output is correct
13 Correct 229 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 6 ms 212 KB Output is correct
20 Correct 24 ms 212 KB Output is correct
21 Correct 252 ms 304 KB Output is correct
22 Correct 199 ms 212 KB Output is correct
23 Correct 201 ms 304 KB Output is correct
24 Correct 227 ms 300 KB Output is correct
25 Correct 203 ms 300 KB Output is correct
26 Correct 233 ms 300 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 2 ms 212 KB Output is correct
30 Correct 101 ms 300 KB Output is correct
31 Correct 198 ms 212 KB Output is correct
32 Correct 210 ms 304 KB Output is correct
33 Correct 248 ms 308 KB Output is correct
34 Correct 221 ms 304 KB Output is correct
35 Correct 215 ms 332 KB Output is correct
36 Correct 226 ms 308 KB Output is correct
37 Correct 476 ms 300 KB Output is correct
38 Execution timed out 1083 ms 212 KB Time limit exceeded
39 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 320 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 7 ms 324 KB Output is correct
7 Correct 28 ms 212 KB Output is correct
8 Correct 199 ms 308 KB Output is correct
9 Correct 199 ms 304 KB Output is correct
10 Correct 210 ms 304 KB Output is correct
11 Correct 204 ms 332 KB Output is correct
12 Correct 230 ms 296 KB Output is correct
13 Correct 239 ms 304 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 2 ms 212 KB Output is correct
17 Correct 97 ms 212 KB Output is correct
18 Correct 199 ms 300 KB Output is correct
19 Correct 204 ms 304 KB Output is correct
20 Correct 240 ms 212 KB Output is correct
21 Correct 230 ms 300 KB Output is correct
22 Correct 195 ms 212 KB Output is correct
23 Correct 263 ms 312 KB Output is correct
24 Correct 455 ms 212 KB Output is correct
25 Execution timed out 1084 ms 212 KB Time limit exceeded
26 Halted 0 ms 0 KB -