답안 #610528

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
610528 2022-07-28T09:18:55 Z nohaxjustsoflo Bali Sculptures (APIO15_sculpture) C++17
71 / 100
1000 ms 16084 KB
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update> order_set;
mt19937 mt_rand(chrono::high_resolution_clock::now().time_since_epoch().count());
//uniform_int_distribution<int> gen; ///(min, max)
//int random() {return gen(mt_rand);}
const int mxN=2001;
const int mod=998244353;
const int mxlogN=40;
const int mxK=26;
const ll inf=1e18;
const int K=600;
int dp[mxN][mxN], a[mxN], n, A, B;
ll check(int i, int k, ll msk)
{
    if(i==n) return k>=A&&k<=B;
    if(~dp[i][k]) return dp[i][k];
    ll sum=0;
    for(int j=i+1; j<=n; j++)
    {
        sum+=a[j-1];
        if((msk&sum)==sum) if(check(j,k+1,msk)) return dp[i][k]=1;
    }
    return dp[i][k]=0;
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    for(int i=0; i<mxN; i++) for(int j=0; j<mxN; j++) dp[i][j]=-1;

    cin >> n >> A >> B;
    for(int i=0; i<n; i++) cin >> a[i];
    ll msk=(1LL<<(mxlogN+1))-1;
    for(int j=0; j<=mxlogN; j++)
    {
        msk^=check(0,0,msk^1LL<<(mxlogN-j))<<(mxlogN-j);
        for(int i=0; i<mxN; i++) for(int j=0; j<mxN; j++) dp[i][j]=-1;
    }
    cout << msk << "\n";
}
/*
6 2 2
8 1 2 1 5 4
*/
# 결과 실행 시간 메모리 Grader output
1 Correct 82 ms 15984 KB Output is correct
2 Correct 76 ms 15980 KB Output is correct
3 Correct 79 ms 15996 KB Output is correct
4 Correct 75 ms 15956 KB Output is correct
5 Correct 73 ms 15976 KB Output is correct
6 Correct 83 ms 15980 KB Output is correct
7 Correct 74 ms 15984 KB Output is correct
8 Correct 73 ms 15984 KB Output is correct
9 Correct 76 ms 15984 KB Output is correct
10 Correct 75 ms 15988 KB Output is correct
11 Correct 73 ms 15956 KB Output is correct
12 Correct 75 ms 15988 KB Output is correct
13 Correct 75 ms 15984 KB Output is correct
14 Correct 80 ms 15956 KB Output is correct
15 Correct 83 ms 15980 KB Output is correct
16 Correct 74 ms 15984 KB Output is correct
17 Correct 74 ms 15992 KB Output is correct
18 Correct 76 ms 15984 KB Output is correct
19 Correct 78 ms 15996 KB Output is correct
20 Correct 74 ms 15980 KB Output is correct
21 Correct 78 ms 15984 KB Output is correct
22 Correct 81 ms 15988 KB Output is correct
23 Correct 75 ms 15956 KB Output is correct
24 Correct 79 ms 15984 KB Output is correct
25 Correct 78 ms 15984 KB Output is correct
26 Correct 74 ms 15996 KB Output is correct
27 Correct 80 ms 15988 KB Output is correct
28 Correct 78 ms 15956 KB Output is correct
29 Correct 76 ms 16080 KB Output is correct
30 Correct 72 ms 15980 KB Output is correct
31 Correct 72 ms 15984 KB Output is correct
32 Correct 86 ms 15980 KB Output is correct
33 Correct 77 ms 15984 KB Output is correct
34 Correct 73 ms 15984 KB Output is correct
35 Correct 73 ms 15956 KB Output is correct
36 Correct 80 ms 15980 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 73 ms 15980 KB Output is correct
2 Correct 79 ms 15956 KB Output is correct
3 Correct 76 ms 15976 KB Output is correct
4 Correct 83 ms 15980 KB Output is correct
5 Correct 74 ms 15988 KB Output is correct
6 Correct 75 ms 15980 KB Output is correct
7 Correct 74 ms 15956 KB Output is correct
8 Correct 85 ms 15956 KB Output is correct
9 Correct 77 ms 15984 KB Output is correct
10 Correct 76 ms 15956 KB Output is correct
11 Correct 84 ms 15980 KB Output is correct
12 Correct 74 ms 15956 KB Output is correct
13 Correct 74 ms 15984 KB Output is correct
14 Correct 79 ms 15992 KB Output is correct
15 Correct 72 ms 15984 KB Output is correct
16 Correct 79 ms 15984 KB Output is correct
17 Correct 80 ms 15956 KB Output is correct
18 Correct 76 ms 15956 KB Output is correct
19 Correct 73 ms 15956 KB Output is correct
20 Correct 77 ms 15980 KB Output is correct
21 Correct 84 ms 15980 KB Output is correct
22 Correct 74 ms 15980 KB Output is correct
23 Correct 74 ms 15984 KB Output is correct
24 Correct 80 ms 15956 KB Output is correct
25 Correct 80 ms 15984 KB Output is correct
26 Correct 78 ms 15984 KB Output is correct
27 Correct 74 ms 15956 KB Output is correct
28 Correct 78 ms 15956 KB Output is correct
29 Correct 78 ms 15984 KB Output is correct
30 Correct 80 ms 15984 KB Output is correct
31 Correct 74 ms 15956 KB Output is correct
32 Correct 76 ms 15996 KB Output is correct
33 Correct 80 ms 15980 KB Output is correct
34 Correct 77 ms 15956 KB Output is correct
35 Correct 73 ms 15980 KB Output is correct
36 Correct 74 ms 15980 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 74 ms 15976 KB Output is correct
2 Correct 78 ms 15980 KB Output is correct
3 Correct 74 ms 15956 KB Output is correct
4 Correct 75 ms 15992 KB Output is correct
5 Correct 72 ms 15956 KB Output is correct
6 Correct 84 ms 15988 KB Output is correct
7 Correct 73 ms 15980 KB Output is correct
8 Correct 78 ms 15984 KB Output is correct
9 Correct 75 ms 15956 KB Output is correct
10 Correct 79 ms 15984 KB Output is correct
11 Correct 76 ms 15984 KB Output is correct
12 Correct 72 ms 15956 KB Output is correct
13 Correct 73 ms 15984 KB Output is correct
14 Correct 80 ms 15988 KB Output is correct
15 Correct 79 ms 15980 KB Output is correct
16 Correct 74 ms 15956 KB Output is correct
17 Correct 74 ms 15956 KB Output is correct
18 Correct 73 ms 15984 KB Output is correct
19 Correct 77 ms 15984 KB Output is correct
20 Correct 77 ms 15956 KB Output is correct
21 Correct 73 ms 15984 KB Output is correct
22 Correct 75 ms 15984 KB Output is correct
23 Correct 75 ms 15956 KB Output is correct
24 Correct 83 ms 15984 KB Output is correct
25 Correct 78 ms 15988 KB Output is correct
26 Correct 78 ms 15956 KB Output is correct
27 Correct 75 ms 15988 KB Output is correct
28 Correct 74 ms 15988 KB Output is correct
29 Correct 75 ms 15984 KB Output is correct
30 Correct 98 ms 15984 KB Output is correct
31 Correct 78 ms 15984 KB Output is correct
32 Correct 75 ms 15956 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 74 ms 15956 KB Output is correct
2 Correct 74 ms 15976 KB Output is correct
3 Correct 74 ms 15980 KB Output is correct
4 Correct 73 ms 15980 KB Output is correct
5 Correct 75 ms 15984 KB Output is correct
6 Correct 74 ms 15984 KB Output is correct
7 Correct 75 ms 15984 KB Output is correct
8 Correct 74 ms 15980 KB Output is correct
9 Correct 75 ms 15992 KB Output is correct
10 Correct 77 ms 16076 KB Output is correct
11 Correct 81 ms 15956 KB Output is correct
12 Correct 79 ms 15952 KB Output is correct
13 Correct 75 ms 15956 KB Output is correct
14 Correct 74 ms 15956 KB Output is correct
15 Correct 73 ms 15980 KB Output is correct
16 Correct 75 ms 15956 KB Output is correct
17 Correct 75 ms 15984 KB Output is correct
18 Correct 78 ms 15956 KB Output is correct
19 Correct 74 ms 15980 KB Output is correct
20 Correct 73 ms 15984 KB Output is correct
21 Correct 73 ms 15956 KB Output is correct
22 Correct 74 ms 15984 KB Output is correct
23 Correct 77 ms 15956 KB Output is correct
24 Correct 78 ms 15956 KB Output is correct
25 Correct 73 ms 15956 KB Output is correct
26 Correct 75 ms 15980 KB Output is correct
27 Correct 74 ms 16048 KB Output is correct
28 Correct 73 ms 15956 KB Output is correct
29 Correct 80 ms 15988 KB Output is correct
30 Correct 73 ms 15896 KB Output is correct
31 Correct 74 ms 15988 KB Output is correct
32 Correct 75 ms 15980 KB Output is correct
33 Correct 75 ms 15984 KB Output is correct
34 Correct 77 ms 15980 KB Output is correct
35 Correct 72 ms 15980 KB Output is correct
36 Correct 73 ms 15920 KB Output is correct
37 Correct 77 ms 15992 KB Output is correct
38 Correct 83 ms 15956 KB Output is correct
39 Correct 76 ms 15984 KB Output is correct
40 Correct 78 ms 16076 KB Output is correct
41 Correct 76 ms 15980 KB Output is correct
42 Correct 85 ms 15984 KB Output is correct
43 Correct 88 ms 16072 KB Output is correct
44 Correct 76 ms 15956 KB Output is correct
45 Correct 83 ms 15984 KB Output is correct
46 Correct 82 ms 15984 KB Output is correct
47 Correct 79 ms 15980 KB Output is correct
48 Correct 84 ms 16000 KB Output is correct
49 Correct 83 ms 15956 KB Output is correct
50 Correct 83 ms 15988 KB Output is correct
51 Correct 79 ms 15992 KB Output is correct
52 Correct 80 ms 16004 KB Output is correct
53 Correct 116 ms 16084 KB Output is correct
54 Correct 88 ms 15988 KB Output is correct
55 Correct 73 ms 15988 KB Output is correct
56 Correct 75 ms 15956 KB Output is correct
57 Correct 78 ms 15988 KB Output is correct
58 Correct 74 ms 15956 KB Output is correct
59 Correct 83 ms 16000 KB Output is correct
60 Correct 72 ms 16004 KB Output is correct
61 Correct 87 ms 15984 KB Output is correct
62 Correct 81 ms 15988 KB Output is correct
63 Correct 76 ms 15984 KB Output is correct
64 Correct 76 ms 16000 KB Output is correct
65 Correct 73 ms 15992 KB Output is correct
66 Correct 75 ms 15980 KB Output is correct
67 Correct 75 ms 15984 KB Output is correct
68 Correct 82 ms 15984 KB Output is correct
69 Correct 73 ms 15988 KB Output is correct
70 Correct 74 ms 15956 KB Output is correct
71 Correct 79 ms 16008 KB Output is correct
72 Correct 76 ms 15984 KB Output is correct
73 Correct 76 ms 15992 KB Output is correct
74 Correct 77 ms 15984 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 73 ms 15956 KB Output is correct
2 Correct 74 ms 15984 KB Output is correct
3 Correct 83 ms 15956 KB Output is correct
4 Correct 75 ms 15976 KB Output is correct
5 Correct 74 ms 15956 KB Output is correct
6 Correct 73 ms 15956 KB Output is correct
7 Correct 73 ms 15980 KB Output is correct
8 Correct 75 ms 15956 KB Output is correct
9 Correct 84 ms 15988 KB Output is correct
10 Correct 82 ms 15992 KB Output is correct
11 Correct 75 ms 15988 KB Output is correct
12 Correct 75 ms 15984 KB Output is correct
13 Correct 73 ms 15984 KB Output is correct
14 Correct 74 ms 15984 KB Output is correct
15 Correct 74 ms 15956 KB Output is correct
16 Correct 85 ms 15956 KB Output is correct
17 Correct 73 ms 15984 KB Output is correct
18 Correct 73 ms 15996 KB Output is correct
19 Correct 75 ms 15988 KB Output is correct
20 Correct 77 ms 15880 KB Output is correct
21 Correct 80 ms 15956 KB Output is correct
22 Correct 76 ms 15980 KB Output is correct
23 Correct 74 ms 15988 KB Output is correct
24 Correct 79 ms 15984 KB Output is correct
25 Correct 74 ms 15980 KB Output is correct
26 Correct 76 ms 15992 KB Output is correct
27 Correct 76 ms 15980 KB Output is correct
28 Correct 77 ms 15996 KB Output is correct
29 Correct 74 ms 15956 KB Output is correct
30 Correct 78 ms 15980 KB Output is correct
31 Correct 74 ms 15984 KB Output is correct
32 Correct 75 ms 15984 KB Output is correct
33 Correct 76 ms 15956 KB Output is correct
34 Correct 74 ms 15980 KB Output is correct
35 Correct 91 ms 15984 KB Output is correct
36 Correct 100 ms 15956 KB Output is correct
37 Correct 81 ms 15980 KB Output is correct
38 Correct 75 ms 15956 KB Output is correct
39 Correct 75 ms 15880 KB Output is correct
40 Correct 98 ms 15956 KB Output is correct
41 Correct 77 ms 15984 KB Output is correct
42 Correct 79 ms 15988 KB Output is correct
43 Correct 86 ms 15956 KB Output is correct
44 Correct 81 ms 15988 KB Output is correct
45 Correct 77 ms 15984 KB Output is correct
46 Correct 82 ms 15956 KB Output is correct
47 Correct 94 ms 15984 KB Output is correct
48 Correct 96 ms 16000 KB Output is correct
49 Correct 76 ms 15984 KB Output is correct
50 Correct 76 ms 15956 KB Output is correct
51 Correct 85 ms 15988 KB Output is correct
52 Correct 720 ms 16028 KB Output is correct
53 Correct 82 ms 16052 KB Output is correct
54 Execution timed out 1083 ms 15984 KB Time limit exceeded
55 Halted 0 ms 0 KB -