답안 #766387

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
766387 2023-06-25T15:33:19 Z 1ne Bali Sculptures (APIO15_sculpture) C++14
21 / 100
114 ms 8612 KB
#include<bits/stdc++.h>
using namespace std; 
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	long long n,a,b;cin>>n>>a>>b;
	vector<long long>arr(n);
	for (long long i = 0;i<n;++i){
		cin>>arr[i];
	}
	const long long inf = 1e15;
	const int k = 15;
	auto query = [&](int u,int v){
	  long long ans = 0;
	  for (int i = u;i<=v;++i){
	  	ans+=arr[i];
	  }
	  return ans;
	};
	vector<vector<vector<long long>>>dp(n,vector<vector<long long>>(n,vector<long long>(n,-1)));
	function<long long(int,int,int)>solve = [&](int u,int v,int kk){
	  if (u == n){
	  	if (kk >= a && kk <= b){
	  		return 0LL;
	  	}
	  	return inf;
	  }
	  if (dp[u][v][kk]!= -1){
	  	return dp[u][v][kk];
	  }
	  long long ans = inf;
	  for (int i = u + 1;i<=n;++i){
	  	ans = min(ans,(solve(i,u,kk + 1) | query(u,i - 1)));	
	  }
	  return dp[u][v][kk] = ans;
	};
	cout<<solve(0,0,0)<<'\n';
	return 0;
}

Compilation message

sculpture.cpp: In function 'int main()':
sculpture.cpp:12:12: warning: unused variable 'k' [-Wunused-variable]
   12 |  const int k = 15;
      |            ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 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 1 ms 340 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 0 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 0 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 0 ms 212 KB Output is correct
19 Correct 0 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Incorrect 1 ms 340 KB Output isn't correct
22 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 0 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 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 0 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 0 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 0 ms 212 KB Output is correct
19 Correct 0 ms 340 KB Output is correct
20 Correct 0 ms 340 KB Output is correct
21 Incorrect 0 ms 340 KB Output isn't correct
22 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 0 ms 252 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 0 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 0 ms 376 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 2 ms 724 KB Output is correct
17 Correct 2 ms 852 KB Output is correct
18 Correct 4 ms 1364 KB Output is correct
19 Correct 4 ms 1364 KB Output is correct
20 Correct 4 ms 1364 KB Output is correct
21 Correct 4 ms 1364 KB Output is correct
22 Correct 4 ms 1364 KB Output is correct
23 Correct 4 ms 1364 KB Output is correct
24 Correct 5 ms 1364 KB Output is correct
25 Correct 12 ms 2516 KB Output is correct
26 Correct 29 ms 4324 KB Output is correct
27 Correct 65 ms 6436 KB Output is correct
28 Correct 92 ms 8612 KB Output is correct
29 Correct 114 ms 8532 KB Output is correct
30 Correct 92 ms 8512 KB Output is correct
31 Correct 93 ms 8532 KB Output is correct
32 Correct 95 ms 8552 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 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 0 ms 212 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 0 ms 340 KB Output is correct
12 Correct 0 ms 340 KB Output is correct
13 Correct 0 ms 340 KB Output is correct
14 Correct 0 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 0 ms 212 KB Output is correct
19 Correct 0 ms 340 KB Output is correct
20 Correct 0 ms 340 KB Output is correct
21 Incorrect 1 ms 340 KB Output isn't correct
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 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 0 ms 212 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 0 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 340 KB Output is correct
17 Correct 0 ms 340 KB Output is correct
18 Incorrect 0 ms 340 KB Output isn't correct
19 Halted 0 ms 0 KB -