답안 #739281

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
739281 2023-05-10T09:40:42 Z BidoTeima Bali Sculptures (APIO15_sculpture) C++17
71 / 100
1000 ms 596 KB
/*
ID: BidoTeima
LANG: C++11
TASK:
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long; 
void moo(string filename);
void ACPLS(string str = "")
{
    if(str=="NOF")return;
    if(str.size() && str != "IIOT")
        moo(str);
    else if(str != "IIOT"){
#ifndef ONLINE_JUDGE
        freopen("output.txt", "w", stdout);
        freopen("input.txt", "r", stdin);
#endif
    }
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
void moo(string fileName){
    freopen((fileName+".in").c_str(),"r",stdin);
    freopen((fileName+".out").c_str(),"w",stdout);
}
#define tcccc         \
    int tttttt/*,subtask*/;    \
    cin >> tttttt/* >> subtask*/; \
    while (tttttt--)/*end
*/ 
ll ans = (1ll << 50) - 1, x = 0;
int n, a, b;
ll arr[5005];
ll sum(int l, int r){
    return (!l ? arr[r] : arr[r] - arr[l - 1]);
}
bool f(){
    bool dp[n + 1][n + 1]{};
    dp[0][0] = 1;
    for(int k = 0; k < n; k++){
        for(int i = 0; i < n; i++){
            for(int j = i; j < n; j++){
                if(!(sum(i, j) & x)){
                    dp[j + 1][k + 1] |= dp[i][k];
                }
            }
        }
    }
    for(int k = a; k <= b; k++){
        if(dp[n][k])
            return 1;
    }
    return 0;
}
int main()
{    
    //ACPLS("");     
    cin>>n>>a>>b;
    cin>>arr[0];
    for(int i = 1; i < n; i++){
        cin>>arr[i]; arr[i] += arr[i - 1];
    }
    for(int i = 49; i >= 0; i--){
        x ^= 1ll << i;
        if(f())
            ans ^= 1ll << i;
        else
            x ^= 1ll << i;
    }
    cout<<ans;
}

Compilation message

sculpture.cpp: In function 'void ACPLS(std::string)':
sculpture.cpp:17:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |         freopen("output.txt", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
sculpture.cpp:18:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |         freopen("input.txt", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
sculpture.cpp: In function 'void moo(std::string)':
sculpture.cpp:26:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   26 |     freopen((fileName+".in").c_str(),"r",stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sculpture.cpp:27:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   27 |     freopen((fileName+".out").c_str(),"w",stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 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 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 304 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 304 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 304 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 308 KB Output is correct
22 Correct 1 ms 288 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 1 ms 304 KB Output is correct
30 Correct 1 ms 300 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 1 ms 296 KB Output is correct
33 Correct 1 ms 212 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 304 KB Output is correct
2 Correct 1 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 1 ms 300 KB Output is correct
7 Correct 1 ms 300 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 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 1 ms 212 KB Output is correct
20 Correct 1 ms 300 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 300 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 300 KB Output is correct
26 Correct 1 ms 212 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 300 KB Output is correct
30 Correct 4 ms 212 KB Output is correct
31 Correct 6 ms 212 KB Output is correct
32 Correct 6 ms 212 KB Output is correct
33 Correct 6 ms 212 KB Output is correct
34 Correct 5 ms 212 KB Output is correct
35 Correct 6 ms 308 KB Output is correct
36 Correct 6 ms 300 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 304 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 1 ms 304 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 3 ms 212 KB Output is correct
17 Correct 3 ms 308 KB Output is correct
18 Correct 5 ms 212 KB Output is correct
19 Correct 5 ms 308 KB Output is correct
20 Correct 6 ms 300 KB Output is correct
21 Correct 6 ms 212 KB Output is correct
22 Correct 6 ms 212 KB Output is correct
23 Correct 6 ms 300 KB Output is correct
24 Correct 6 ms 300 KB Output is correct
25 Correct 11 ms 304 KB Output is correct
26 Correct 18 ms 212 KB Output is correct
27 Correct 31 ms 284 KB Output is correct
28 Correct 36 ms 212 KB Output is correct
29 Correct 35 ms 212 KB Output is correct
30 Correct 36 ms 212 KB Output is correct
31 Correct 36 ms 212 KB Output is correct
32 Correct 39 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 308 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 1 ms 304 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 304 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 304 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 304 KB Output is correct
16 Correct 1 ms 308 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 300 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 1 ms 308 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 0 ms 212 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 1 ms 212 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 1 ms 304 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 1 ms 212 KB Output is correct
37 Correct 1 ms 304 KB Output is correct
38 Correct 1 ms 304 KB Output is correct
39 Correct 3 ms 212 KB Output is correct
40 Correct 3 ms 304 KB Output is correct
41 Correct 5 ms 212 KB Output is correct
42 Correct 5 ms 212 KB Output is correct
43 Correct 5 ms 212 KB Output is correct
44 Correct 5 ms 212 KB Output is correct
45 Correct 6 ms 212 KB Output is correct
46 Correct 6 ms 212 KB Output is correct
47 Correct 6 ms 300 KB Output is correct
48 Correct 11 ms 300 KB Output is correct
49 Correct 19 ms 212 KB Output is correct
50 Correct 28 ms 300 KB Output is correct
51 Correct 36 ms 212 KB Output is correct
52 Correct 35 ms 288 KB Output is correct
53 Correct 36 ms 212 KB Output is correct
54 Correct 37 ms 212 KB Output is correct
55 Correct 39 ms 300 KB Output is correct
56 Correct 6 ms 212 KB Output is correct
57 Correct 19 ms 212 KB Output is correct
58 Correct 26 ms 304 KB Output is correct
59 Correct 34 ms 212 KB Output is correct
60 Correct 32 ms 212 KB Output is correct
61 Correct 30 ms 212 KB Output is correct
62 Correct 35 ms 212 KB Output is correct
63 Correct 37 ms 304 KB Output is correct
64 Correct 27 ms 212 KB Output is correct
65 Correct 6 ms 308 KB Output is correct
66 Correct 11 ms 304 KB Output is correct
67 Correct 16 ms 300 KB Output is correct
68 Correct 26 ms 212 KB Output is correct
69 Correct 33 ms 292 KB Output is correct
70 Correct 30 ms 212 KB Output is correct
71 Correct 31 ms 212 KB Output is correct
72 Correct 36 ms 212 KB Output is correct
73 Correct 36 ms 212 KB Output is correct
74 Correct 35 ms 304 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 300 KB Output is correct
2 Correct 1 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 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 304 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 296 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 300 KB Output is correct
16 Correct 1 ms 304 KB Output is correct
17 Correct 1 ms 304 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 2 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 3 ms 212 KB Output is correct
27 Correct 4 ms 212 KB Output is correct
28 Correct 5 ms 304 KB Output is correct
29 Correct 5 ms 212 KB Output is correct
30 Correct 6 ms 304 KB Output is correct
31 Correct 6 ms 212 KB Output is correct
32 Correct 6 ms 212 KB Output is correct
33 Correct 6 ms 212 KB Output is correct
34 Correct 5 ms 212 KB Output is correct
35 Correct 11 ms 308 KB Output is correct
36 Correct 18 ms 304 KB Output is correct
37 Correct 27 ms 212 KB Output is correct
38 Correct 36 ms 212 KB Output is correct
39 Correct 37 ms 292 KB Output is correct
40 Correct 36 ms 304 KB Output is correct
41 Correct 36 ms 212 KB Output is correct
42 Correct 35 ms 288 KB Output is correct
43 Correct 6 ms 212 KB Output is correct
44 Correct 17 ms 336 KB Output is correct
45 Correct 26 ms 300 KB Output is correct
46 Correct 33 ms 212 KB Output is correct
47 Correct 31 ms 308 KB Output is correct
48 Correct 32 ms 296 KB Output is correct
49 Correct 36 ms 212 KB Output is correct
50 Correct 35 ms 212 KB Output is correct
51 Correct 34 ms 296 KB Output is correct
52 Execution timed out 1091 ms 596 KB Time limit exceeded
53 Halted 0 ms 0 KB -