답안 #74281

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
74281 2018-08-30T19:50:46 Z Vardanyan Bali Sculptures (APIO15_sculpture) C++14
46 / 100
1000 ms 106672 KB
//#pragma GCC optimize "-O3"
#include <bits/stdc++.h>
using namespace std;
const int N = 2005;
int A[N];
int K;
int n;
vector<long long> dp[N][N];
int main()
{
    int a,b;
    scanf("%d%d%d",&n,&a,&b);
    for(int i = 1;i<=n;i++) scanf("%d",&A[i]);
    long long c = 0;
    for(int i = 1;i<=n;i++){
        c+=A[i];
        dp[i][1].push_back(c);
    }
    long long ans = 10000000000000007;
    for(int k = 2;k<=b;k++){
        for(int i = 1;i<=n;i++){
            c = A[i];
            map<long long,int> mp;
            for(int j = i-1;j>=1;j--){
                for(int q = 0;q<dp[j][k-1].size();q++){
            if(!mp[dp[j][k-1][q]|c]){
                    dp[i][k].push_back(dp[j][k-1][q]|c);
               //     if(k>=a && i == n) ans = min(ans,dp[j][k-1][q]|c);
                    mp[dp[j][k-1][q]|c] = 1;
                }
            }
                c+=A[j];
            }
        }
    }
    for(int i = a;i<=b;i++){
        for(int j = 0;j<dp[n][i].size();j++){
            ans = min(ans,dp[n][i][j]);
        }
    }
    cout<<ans<<endl;
    return 0;
}

Compilation message

sculpture.cpp: In function 'int main()':
sculpture.cpp:25:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                 for(int q = 0;q<dp[j][k-1].size();q++){
                               ~^~~~~~~~~~~~~~~~~~
sculpture.cpp:37:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int j = 0;j<dp[n][i].size();j++){
                       ~^~~~~~~~~~~~~~~~
sculpture.cpp:12:10: 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:13:34: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i = 1;i<=n;i++) scanf("%d",&A[i]);
                             ~~~~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 77 ms 94712 KB Output is correct
2 Correct 78 ms 94712 KB Output is correct
3 Correct 81 ms 94876 KB Output is correct
4 Correct 80 ms 94876 KB Output is correct
5 Correct 78 ms 95028 KB Output is correct
6 Correct 77 ms 95028 KB Output is correct
7 Correct 78 ms 95028 KB Output is correct
8 Correct 78 ms 95028 KB Output is correct
9 Correct 80 ms 95028 KB Output is correct
10 Correct 77 ms 95048 KB Output is correct
11 Correct 78 ms 95128 KB Output is correct
12 Correct 82 ms 95128 KB Output is correct
13 Correct 78 ms 95128 KB Output is correct
14 Correct 77 ms 95128 KB Output is correct
15 Correct 80 ms 95128 KB Output is correct
16 Correct 78 ms 95148 KB Output is correct
17 Correct 78 ms 95148 KB Output is correct
18 Correct 78 ms 95148 KB Output is correct
19 Correct 81 ms 95148 KB Output is correct
20 Correct 78 ms 95148 KB Output is correct
21 Correct 79 ms 95148 KB Output is correct
22 Correct 79 ms 95148 KB Output is correct
23 Correct 80 ms 95148 KB Output is correct
24 Correct 80 ms 95308 KB Output is correct
25 Correct 78 ms 95308 KB Output is correct
26 Correct 78 ms 95308 KB Output is correct
27 Correct 79 ms 95308 KB Output is correct
28 Correct 79 ms 95308 KB Output is correct
29 Correct 78 ms 95308 KB Output is correct
30 Correct 80 ms 95308 KB Output is correct
31 Correct 78 ms 95308 KB Output is correct
32 Correct 79 ms 95308 KB Output is correct
33 Correct 81 ms 95308 KB Output is correct
34 Correct 80 ms 95308 KB Output is correct
35 Correct 80 ms 95308 KB Output is correct
36 Correct 80 ms 95308 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 79 ms 95308 KB Output is correct
2 Correct 78 ms 95308 KB Output is correct
3 Correct 82 ms 95308 KB Output is correct
4 Correct 80 ms 95308 KB Output is correct
5 Correct 82 ms 95308 KB Output is correct
6 Correct 78 ms 95308 KB Output is correct
7 Correct 79 ms 95308 KB Output is correct
8 Correct 80 ms 95308 KB Output is correct
9 Correct 79 ms 95308 KB Output is correct
10 Correct 80 ms 95308 KB Output is correct
11 Correct 79 ms 95308 KB Output is correct
12 Correct 79 ms 95308 KB Output is correct
13 Correct 81 ms 95308 KB Output is correct
14 Correct 81 ms 95308 KB Output is correct
15 Correct 81 ms 95308 KB Output is correct
16 Correct 79 ms 95308 KB Output is correct
17 Correct 77 ms 95308 KB Output is correct
18 Correct 77 ms 95308 KB Output is correct
19 Correct 78 ms 95308 KB Output is correct
20 Correct 78 ms 95308 KB Output is correct
21 Correct 84 ms 95308 KB Output is correct
22 Correct 81 ms 95308 KB Output is correct
23 Correct 83 ms 95308 KB Output is correct
24 Correct 82 ms 95308 KB Output is correct
25 Correct 81 ms 95308 KB Output is correct
26 Correct 78 ms 95308 KB Output is correct
27 Correct 81 ms 95308 KB Output is correct
28 Correct 82 ms 95308 KB Output is correct
29 Correct 92 ms 95308 KB Output is correct
30 Correct 87 ms 95336 KB Output is correct
31 Correct 101 ms 95468 KB Output is correct
32 Correct 88 ms 95472 KB Output is correct
33 Correct 82 ms 95472 KB Output is correct
34 Correct 90 ms 95560 KB Output is correct
35 Correct 90 ms 95560 KB Output is correct
36 Correct 90 ms 95560 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 83 ms 95560 KB Output is correct
2 Correct 82 ms 95560 KB Output is correct
3 Correct 88 ms 95560 KB Output is correct
4 Correct 83 ms 95560 KB Output is correct
5 Correct 94 ms 95560 KB Output is correct
6 Correct 83 ms 95560 KB Output is correct
7 Correct 83 ms 95560 KB Output is correct
8 Correct 85 ms 95560 KB Output is correct
9 Correct 78 ms 95560 KB Output is correct
10 Correct 82 ms 95560 KB Output is correct
11 Correct 85 ms 95560 KB Output is correct
12 Correct 88 ms 95560 KB Output is correct
13 Correct 88 ms 95560 KB Output is correct
14 Correct 88 ms 95560 KB Output is correct
15 Correct 81 ms 95560 KB Output is correct
16 Correct 85 ms 95560 KB Output is correct
17 Correct 87 ms 95560 KB Output is correct
18 Correct 97 ms 95560 KB Output is correct
19 Correct 90 ms 95560 KB Output is correct
20 Correct 99 ms 95560 KB Output is correct
21 Correct 89 ms 95560 KB Output is correct
22 Correct 89 ms 95560 KB Output is correct
23 Correct 85 ms 95560 KB Output is correct
24 Correct 96 ms 95620 KB Output is correct
25 Correct 115 ms 95704 KB Output is correct
26 Correct 165 ms 96476 KB Output is correct
27 Correct 229 ms 97384 KB Output is correct
28 Correct 297 ms 98020 KB Output is correct
29 Correct 218 ms 98020 KB Output is correct
30 Correct 81 ms 98020 KB Output is correct
31 Correct 332 ms 98224 KB Output is correct
32 Correct 344 ms 98548 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 80 ms 98548 KB Output is correct
2 Correct 78 ms 98548 KB Output is correct
3 Correct 79 ms 98548 KB Output is correct
4 Correct 80 ms 98548 KB Output is correct
5 Correct 84 ms 98548 KB Output is correct
6 Correct 88 ms 98548 KB Output is correct
7 Correct 81 ms 98548 KB Output is correct
8 Correct 81 ms 98548 KB Output is correct
9 Correct 79 ms 98548 KB Output is correct
10 Correct 79 ms 98548 KB Output is correct
11 Correct 82 ms 98548 KB Output is correct
12 Correct 81 ms 98548 KB Output is correct
13 Correct 80 ms 98548 KB Output is correct
14 Correct 80 ms 98548 KB Output is correct
15 Correct 81 ms 98548 KB Output is correct
16 Correct 81 ms 98548 KB Output is correct
17 Correct 80 ms 98548 KB Output is correct
18 Correct 84 ms 98548 KB Output is correct
19 Correct 83 ms 98548 KB Output is correct
20 Correct 81 ms 98548 KB Output is correct
21 Correct 78 ms 98548 KB Output is correct
22 Correct 79 ms 98548 KB Output is correct
23 Correct 83 ms 98548 KB Output is correct
24 Correct 80 ms 98548 KB Output is correct
25 Correct 93 ms 98548 KB Output is correct
26 Correct 90 ms 98548 KB Output is correct
27 Correct 81 ms 98548 KB Output is correct
28 Correct 79 ms 98548 KB Output is correct
29 Correct 80 ms 98548 KB Output is correct
30 Correct 78 ms 98548 KB Output is correct
31 Correct 79 ms 98548 KB Output is correct
32 Correct 80 ms 98548 KB Output is correct
33 Correct 81 ms 98548 KB Output is correct
34 Correct 84 ms 98548 KB Output is correct
35 Correct 80 ms 98548 KB Output is correct
36 Correct 83 ms 98548 KB Output is correct
37 Correct 84 ms 98548 KB Output is correct
38 Correct 79 ms 98548 KB Output is correct
39 Correct 81 ms 98548 KB Output is correct
40 Correct 95 ms 98548 KB Output is correct
41 Correct 91 ms 98548 KB Output is correct
42 Correct 87 ms 98548 KB Output is correct
43 Correct 80 ms 98548 KB Output is correct
44 Correct 93 ms 98548 KB Output is correct
45 Correct 90 ms 98548 KB Output is correct
46 Correct 87 ms 98548 KB Output is correct
47 Correct 93 ms 98548 KB Output is correct
48 Correct 103 ms 98548 KB Output is correct
49 Correct 163 ms 98548 KB Output is correct
50 Correct 229 ms 98548 KB Output is correct
51 Correct 300 ms 98548 KB Output is correct
52 Correct 212 ms 98548 KB Output is correct
53 Correct 84 ms 98548 KB Output is correct
54 Correct 337 ms 98548 KB Output is correct
55 Correct 352 ms 98660 KB Output is correct
56 Correct 673 ms 102916 KB Output is correct
57 Execution timed out 1077 ms 106508 KB Time limit exceeded
58 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 80 ms 106508 KB Output is correct
2 Correct 78 ms 106508 KB Output is correct
3 Correct 79 ms 106508 KB Output is correct
4 Correct 79 ms 106508 KB Output is correct
5 Correct 85 ms 106508 KB Output is correct
6 Correct 81 ms 106508 KB Output is correct
7 Correct 82 ms 106508 KB Output is correct
8 Correct 80 ms 106508 KB Output is correct
9 Correct 100 ms 106508 KB Output is correct
10 Correct 80 ms 106508 KB Output is correct
11 Correct 78 ms 106508 KB Output is correct
12 Correct 81 ms 106508 KB Output is correct
13 Correct 80 ms 106508 KB Output is correct
14 Correct 85 ms 106508 KB Output is correct
15 Correct 82 ms 106508 KB Output is correct
16 Correct 81 ms 106508 KB Output is correct
17 Correct 79 ms 106508 KB Output is correct
18 Correct 82 ms 106508 KB Output is correct
19 Correct 78 ms 106508 KB Output is correct
20 Correct 86 ms 106508 KB Output is correct
21 Correct 80 ms 106508 KB Output is correct
22 Correct 79 ms 106508 KB Output is correct
23 Correct 78 ms 106508 KB Output is correct
24 Correct 81 ms 106508 KB Output is correct
25 Correct 86 ms 106508 KB Output is correct
26 Correct 81 ms 106508 KB Output is correct
27 Correct 92 ms 106508 KB Output is correct
28 Correct 91 ms 106508 KB Output is correct
29 Correct 86 ms 106508 KB Output is correct
30 Correct 80 ms 106508 KB Output is correct
31 Correct 93 ms 106508 KB Output is correct
32 Correct 91 ms 106508 KB Output is correct
33 Correct 86 ms 106508 KB Output is correct
34 Correct 94 ms 106508 KB Output is correct
35 Correct 103 ms 106508 KB Output is correct
36 Correct 161 ms 106508 KB Output is correct
37 Correct 225 ms 106508 KB Output is correct
38 Correct 362 ms 106508 KB Output is correct
39 Correct 211 ms 106508 KB Output is correct
40 Correct 84 ms 106508 KB Output is correct
41 Correct 336 ms 106508 KB Output is correct
42 Correct 344 ms 106508 KB Output is correct
43 Correct 674 ms 106508 KB Output is correct
44 Execution timed out 1082 ms 106672 KB Time limit exceeded
45 Halted 0 ms 0 KB -