# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
40902 | 2018-02-09T22:28:48 Z | IvanC | Bali Sculptures (APIO15_sculpture) | C++14 | 1000 ms | 18472 KB |
#include <bits/stdc++.h> using namespace std; const int MAXN = 102; const int MAXOR = 5096; set<int> dp[MAXN][MAXN]; int best,N,A,B,soma[MAXN]; int calc(int a,int b){return soma[b] - soma[a-1];} void solve(int pos,int resta,int curOr){ if(resta < 0) return; if(dp[pos][resta].count(curOr)) return; dp[pos][resta].insert(curOr); if(pos == N + 1){ if(resta != 0) return; best = min(best,curOr); return; } if(resta == 0) return; for(int quebra = pos;quebra<=N;quebra++){ solve(quebra+1,resta - 1,curOr | calc(pos,quebra)); } } int main(){ scanf("%d %d %d",&N,&A,&B); for(int i = 1;i<=N;i++){ scanf("%d",&soma[i]); soma[i] += soma[i-1]; } best = MAXOR; for(int i = A;i<=B;i++) solve(1,i,0); printf("%d\n",best); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 760 KB | Output is correct |
2 | Correct | 2 ms | 864 KB | Output is correct |
3 | Correct | 2 ms | 864 KB | Output is correct |
4 | Correct | 2 ms | 916 KB | Output is correct |
5 | Correct | 2 ms | 972 KB | Output is correct |
6 | Correct | 2 ms | 1000 KB | Output is correct |
7 | Correct | 2 ms | 1000 KB | Output is correct |
8 | Correct | 2 ms | 1000 KB | Output is correct |
9 | Correct | 2 ms | 1000 KB | Output is correct |
10 | Correct | 2 ms | 1088 KB | Output is correct |
11 | Correct | 2 ms | 1088 KB | Output is correct |
12 | Correct | 2 ms | 1088 KB | Output is correct |
13 | Correct | 2 ms | 1132 KB | Output is correct |
14 | Correct | 2 ms | 1132 KB | Output is correct |
15 | Correct | 3 ms | 1132 KB | Output is correct |
16 | Correct | 2 ms | 1132 KB | Output is correct |
17 | Correct | 2 ms | 1132 KB | Output is correct |
18 | Correct | 2 ms | 1132 KB | Output is correct |
19 | Correct | 2 ms | 1132 KB | Output is correct |
20 | Correct | 2 ms | 1132 KB | Output is correct |
21 | Correct | 2 ms | 1132 KB | Output is correct |
22 | Correct | 2 ms | 1132 KB | Output is correct |
23 | Correct | 2 ms | 1132 KB | Output is correct |
24 | Correct | 2 ms | 1132 KB | Output is correct |
25 | Correct | 2 ms | 1132 KB | Output is correct |
26 | Correct | 2 ms | 1132 KB | Output is correct |
27 | Incorrect | 2 ms | 1132 KB | Output isn't correct |
28 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 1132 KB | Output is correct |
2 | Correct | 2 ms | 1132 KB | Output is correct |
3 | Correct | 2 ms | 1132 KB | Output is correct |
4 | Correct | 2 ms | 1132 KB | Output is correct |
5 | Correct | 2 ms | 1132 KB | Output is correct |
6 | Correct | 2 ms | 1136 KB | Output is correct |
7 | Correct | 2 ms | 1136 KB | Output is correct |
8 | Correct | 2 ms | 1136 KB | Output is correct |
9 | Correct | 2 ms | 1136 KB | Output is correct |
10 | Correct | 2 ms | 1136 KB | Output is correct |
11 | Correct | 2 ms | 1136 KB | Output is correct |
12 | Correct | 2 ms | 1136 KB | Output is correct |
13 | Correct | 2 ms | 1136 KB | Output is correct |
14 | Correct | 2 ms | 1136 KB | Output is correct |
15 | Correct | 2 ms | 1136 KB | Output is correct |
16 | Correct | 2 ms | 1136 KB | Output is correct |
17 | Correct | 2 ms | 1136 KB | Output is correct |
18 | Correct | 2 ms | 1136 KB | Output is correct |
19 | Correct | 2 ms | 1136 KB | Output is correct |
20 | Correct | 2 ms | 1136 KB | Output is correct |
21 | Correct | 2 ms | 1136 KB | Output is correct |
22 | Correct | 2 ms | 1136 KB | Output is correct |
23 | Correct | 2 ms | 1136 KB | Output is correct |
24 | Correct | 2 ms | 1136 KB | Output is correct |
25 | Correct | 2 ms | 1136 KB | Output is correct |
26 | Correct | 3 ms | 1136 KB | Output is correct |
27 | Correct | 3 ms | 1260 KB | Output is correct |
28 | Correct | 3 ms | 1260 KB | Output is correct |
29 | Correct | 4 ms | 1260 KB | Output is correct |
30 | Correct | 18 ms | 2028 KB | Output is correct |
31 | Correct | 78 ms | 3564 KB | Output is correct |
32 | Correct | 40 ms | 3564 KB | Output is correct |
33 | Correct | 2 ms | 3564 KB | Output is correct |
34 | Correct | 34 ms | 3564 KB | Output is correct |
35 | Correct | 32 ms | 3564 KB | Output is correct |
36 | Correct | 17 ms | 3564 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 3564 KB | Output is correct |
2 | Correct | 2 ms | 3564 KB | Output is correct |
3 | Correct | 2 ms | 3564 KB | Output is correct |
4 | Correct | 2 ms | 3564 KB | Output is correct |
5 | Correct | 2 ms | 3564 KB | Output is correct |
6 | Correct | 2 ms | 3564 KB | Output is correct |
7 | Correct | 2 ms | 3564 KB | Output is correct |
8 | Correct | 2 ms | 3564 KB | Output is correct |
9 | Correct | 2 ms | 3564 KB | Output is correct |
10 | Correct | 2 ms | 3564 KB | Output is correct |
11 | Correct | 2 ms | 3564 KB | Output is correct |
12 | Correct | 2 ms | 3564 KB | Output is correct |
13 | Correct | 3 ms | 3564 KB | Output is correct |
14 | Correct | 3 ms | 3564 KB | Output is correct |
15 | Correct | 3 ms | 3564 KB | Output is correct |
16 | Correct | 4 ms | 3564 KB | Output is correct |
17 | Correct | 18 ms | 3564 KB | Output is correct |
18 | Correct | 77 ms | 3588 KB | Output is correct |
19 | Correct | 43 ms | 3588 KB | Output is correct |
20 | Correct | 2 ms | 3588 KB | Output is correct |
21 | Correct | 36 ms | 3588 KB | Output is correct |
22 | Correct | 36 ms | 3588 KB | Output is correct |
23 | Correct | 18 ms | 3588 KB | Output is correct |
24 | Correct | 73 ms | 3692 KB | Output is correct |
25 | Correct | 67 ms | 3692 KB | Output is correct |
26 | Correct | 467 ms | 9548 KB | Output is correct |
27 | Execution timed out | 1071 ms | 18472 KB | Time limit exceeded |
28 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 18472 KB | Output is correct |
2 | Correct | 2 ms | 18472 KB | Output is correct |
3 | Correct | 2 ms | 18472 KB | Output is correct |
4 | Correct | 2 ms | 18472 KB | Output is correct |
5 | Correct | 2 ms | 18472 KB | Output is correct |
6 | Correct | 2 ms | 18472 KB | Output is correct |
7 | Correct | 2 ms | 18472 KB | Output is correct |
8 | Correct | 2 ms | 18472 KB | Output is correct |
9 | Correct | 2 ms | 18472 KB | Output is correct |
10 | Correct | 2 ms | 18472 KB | Output is correct |
11 | Correct | 2 ms | 18472 KB | Output is correct |
12 | Correct | 2 ms | 18472 KB | Output is correct |
13 | Correct | 2 ms | 18472 KB | Output is correct |
14 | Correct | 2 ms | 18472 KB | Output is correct |
15 | Correct | 2 ms | 18472 KB | Output is correct |
16 | Correct | 2 ms | 18472 KB | Output is correct |
17 | Correct | 2 ms | 18472 KB | Output is correct |
18 | Correct | 2 ms | 18472 KB | Output is correct |
19 | Correct | 2 ms | 18472 KB | Output is correct |
20 | Correct | 2 ms | 18472 KB | Output is correct |
21 | Correct | 2 ms | 18472 KB | Output is correct |
22 | Correct | 2 ms | 18472 KB | Output is correct |
23 | Correct | 2 ms | 18472 KB | Output is correct |
24 | Correct | 2 ms | 18472 KB | Output is correct |
25 | Correct | 2 ms | 18472 KB | Output is correct |
26 | Correct | 2 ms | 18472 KB | Output is correct |
27 | Incorrect | 2 ms | 18472 KB | Output isn't correct |
28 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 18472 KB | Output is correct |
2 | Correct | 2 ms | 18472 KB | Output is correct |
3 | Correct | 2 ms | 18472 KB | Output is correct |
4 | Correct | 2 ms | 18472 KB | Output is correct |
5 | Correct | 2 ms | 18472 KB | Output is correct |
6 | Correct | 2 ms | 18472 KB | Output is correct |
7 | Correct | 2 ms | 18472 KB | Output is correct |
8 | Correct | 2 ms | 18472 KB | Output is correct |
9 | Correct | 2 ms | 18472 KB | Output is correct |
10 | Correct | 2 ms | 18472 KB | Output is correct |
11 | Correct | 2 ms | 18472 KB | Output is correct |
12 | Correct | 2 ms | 18472 KB | Output is correct |
13 | Correct | 3 ms | 18472 KB | Output is correct |
14 | Incorrect | 2 ms | 18472 KB | Output isn't correct |
15 | Halted | 0 ms | 0 KB | - |