답안 #411824

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
411824 2021-05-26T04:24:44 Z Karliver Bali Sculptures (APIO15_sculpture) C++14
9 / 100
1000 ms 332 KB
	
 #include <bits/stdc++.h>
 
 #define FIXED_FLOAT(x)  std::fixed <<std::setprecision(20) << (x)
 #define all(v) (v).begin(), (v).end()
 using namespace  std;
 #define forn(i,n) for (int i = 0; i < (n); ++i)
 #define rforn(i, n) for(int i = (n) - 1;i >= 0;--i)
 using ll = long long;
 int mod = (ll)1e9 + 7;
 #define PI acos(-1)
 typedef pair<int, int> pairs;
 
 const int INF = 1e9 + 1;
 const int N = 2e5 + 100;
 const double eps = 1e-7;
 
 template <class T> using V = vector<T>;  // from yosupo 
 template <class T> using VV = V<V<T>>;  // from yosupo
 
 template <typename XPAX>
 void ckma(XPAX &x, XPAX y) {
     x = (x < y ? y : x);
 }
 template <typename XPAX>
 void ckmi(XPAX &x, XPAX y) {
     x = (x > y ? y : x);
 }
 int n;
 int A, B;
 int a[N];
 ll ans;
 void __print(int x) {cerr << x;}
 void __print(long x) {cerr << x;}
 void __print(long long x) {cerr << x;}
 void __print(unsigned x) {cerr << x;}
 void __print(unsigned long x) {cerr << x;}
 void __print(unsigned long long x) {cerr << x;}
 void __print(float x) {cerr << x;}
 void __print(double x) {cerr << x;}
 void __print(long double x) {cerr << x;}
 void __print(char x) {cerr << '\'' << x << '\'';}
 void __print(const char *x) {cerr << '\"' << x << '\"';}
 void __print(const string &x) {cerr << '\"' << x << '\"';}
 void __print(bool x) {cerr << (x ? "true" : "false");}
 
 template<typename T, typename V>
 void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
 template<typename T>
 void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
 void _print() {cerr << "]\n";}
 template <typename T, typename... V>
 void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
 #define debug(x...) cerr << "[" << #x << "] = ["; _print(x)

 void dfs(int now, ll cur, ll cursum, int partition) {
 	if(now == n) {
 		if(cur) {
 			partition++;
 			cursum |= cur;
 		}
 		if(partition >= A && partition <= B) {
 			ckmi(ans, cursum);
 			//debug(ans, partition);
 		}

 		return;
 	}
 	dfs(now + 1, cur + a[now], cursum, partition);
 	dfs(now + 1, 0, (cur + a[now]) | cursum, partition + 1);
 }

 void solve() {
 
 
 	ans = 1e12;
 	cin >> n;
 	
 	cin >> A >> B;
 	forn(i, n) cin >> a[i];
 	dfs(0, 0, 0, 0);
 	cout << ans << '\n';

 
 
 
 }
 void test_case() {
     int t;
     cin >> t;
     forn(p, t) {
 
         //cout << "Case #" << p + 1 << ": ";
         solve();
     }
 }
 int main() {
 
     ios::sync_with_stdio(false);
     cin.tie(nullptr);
     cout.tie(nullptr);
 
     solve();
 
 }
  
# 결과 실행 시간 메모리 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 2 ms 204 KB Output is correct
8 Correct 7 ms 320 KB Output is correct
9 Correct 7 ms 332 KB Output is correct
10 Correct 7 ms 204 KB Output is correct
11 Correct 8 ms 204 KB Output is correct
12 Correct 7 ms 324 KB Output is correct
13 Correct 10 ms 312 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 2 ms 204 KB Output is correct
20 Correct 2 ms 204 KB Output is correct
21 Correct 7 ms 204 KB Output is correct
22 Correct 7 ms 316 KB Output is correct
23 Correct 7 ms 204 KB Output is correct
24 Correct 7 ms 204 KB Output is correct
25 Correct 7 ms 320 KB Output is correct
26 Correct 7 ms 204 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
28 Correct 1 ms 204 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 4 ms 204 KB Output is correct
31 Correct 7 ms 204 KB Output is correct
32 Correct 7 ms 204 KB Output is correct
33 Correct 9 ms 320 KB Output is correct
34 Correct 7 ms 204 KB Output is correct
35 Correct 7 ms 320 KB Output is correct
36 Correct 7 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 2 ms 204 KB Output is correct
8 Correct 7 ms 204 KB Output is correct
9 Correct 9 ms 204 KB Output is correct
10 Correct 7 ms 204 KB Output is correct
11 Correct 7 ms 204 KB Output is correct
12 Correct 7 ms 204 KB Output is correct
13 Correct 7 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 2 ms 204 KB Output is correct
21 Correct 7 ms 204 KB Output is correct
22 Correct 9 ms 320 KB Output is correct
23 Correct 7 ms 204 KB Output is correct
24 Correct 9 ms 204 KB Output is correct
25 Correct 7 ms 204 KB Output is correct
26 Correct 8 ms 204 KB Output is correct
27 Correct 13 ms 320 KB Output is correct
28 Correct 201 ms 308 KB Output is correct
29 Execution timed out 1050 ms 204 KB Time limit exceeded
30 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 2 ms 204 KB Output is correct
8 Correct 7 ms 204 KB Output is correct
9 Correct 9 ms 324 KB Output is correct
10 Correct 9 ms 320 KB Output is correct
11 Correct 8 ms 204 KB Output is correct
12 Correct 7 ms 204 KB Output is correct
13 Correct 7 ms 204 KB Output is correct
14 Correct 13 ms 324 KB Output is correct
15 Correct 206 ms 204 KB Output is correct
16 Execution timed out 1087 ms 204 KB Time limit exceeded
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 2 ms 204 KB Output is correct
8 Correct 7 ms 320 KB Output is correct
9 Correct 7 ms 204 KB Output is correct
10 Correct 9 ms 324 KB Output is correct
11 Correct 7 ms 204 KB Output is correct
12 Correct 7 ms 204 KB Output is correct
13 Correct 7 ms 204 KB Output is correct
14 Correct 1 ms 256 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 320 KB Output is correct
20 Correct 2 ms 204 KB Output is correct
21 Correct 7 ms 204 KB Output is correct
22 Correct 7 ms 320 KB Output is correct
23 Correct 7 ms 204 KB Output is correct
24 Correct 7 ms 204 KB Output is correct
25 Correct 8 ms 320 KB Output is correct
26 Correct 9 ms 204 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
28 Correct 1 ms 204 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 4 ms 324 KB Output is correct
31 Correct 7 ms 324 KB Output is correct
32 Correct 7 ms 204 KB Output is correct
33 Correct 7 ms 204 KB Output is correct
34 Correct 7 ms 204 KB Output is correct
35 Correct 7 ms 204 KB Output is correct
36 Correct 8 ms 204 KB Output is correct
37 Correct 13 ms 204 KB Output is correct
38 Correct 196 ms 304 KB Output is correct
39 Execution timed out 1090 ms 204 KB Time limit exceeded
40 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 2 ms 204 KB Output is correct
8 Correct 9 ms 204 KB Output is correct
9 Correct 7 ms 316 KB Output is correct
10 Correct 7 ms 204 KB Output is correct
11 Correct 7 ms 320 KB Output is correct
12 Correct 7 ms 204 KB Output is correct
13 Correct 7 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 4 ms 324 KB Output is correct
18 Correct 7 ms 204 KB Output is correct
19 Correct 7 ms 324 KB Output is correct
20 Correct 7 ms 204 KB Output is correct
21 Correct 7 ms 204 KB Output is correct
22 Correct 7 ms 204 KB Output is correct
23 Correct 7 ms 204 KB Output is correct
24 Correct 13 ms 204 KB Output is correct
25 Correct 198 ms 304 KB Output is correct
26 Execution timed out 1081 ms 204 KB Time limit exceeded
27 Halted 0 ms 0 KB -