Submission #1085111

# Submission time Handle Problem Language Result Execution time Memory
1085111 2024-09-07T14:19:19 Z MrPavlito Bali Sculptures (APIO15_sculpture) C++17
0 / 100
16 ms 31904 KB
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define sc second
//#define endl "\n"
#define pii pair<int,int>

using namespace std;

const int MAXN = 2e3+5;
const int mod7 = 1e9+7;
const long long inf = 1e18;

vector<vector<int>> sums(MAXN,vector<int>(MAXN));
int n,a,b;
int pref[MAXN];


void checka1(int& ans, int bt)
{
    vector<int> dp(MAXN, inf);
    dp[0] = 0;
    for(int i=1; i<=n; i++)
    {
        for(int j=i; j>0; j--)
        {
            int trsum = pref[i]- pref[j-1];
            int p = trsum^ans;
            if(p >=(1<<bt))continue;
            dp[i] = min(dp[i],dp[j-1] + 1);
        }
    }
    if(dp[n] > b)ans|=(1<<bt);
}


signed main()
{
    ios_base::sync_with_stdio(false),cin.tie(0), cout.tie(0);
    int tt=1;
    //cin >> tt;
    while(tt--)
    {

        cin >> n >> a >> b;
        vector<int>niz(n);
        for(int i=0; i<n; i++)
        {
            cin >> niz[i];
            pref[i+1] = pref[i] + niz[i];
        }
        for(int i=0; i<n; i++)for(int j=i; j<n; j++)sums[i][j] = pref[i+1]-pref[j];
        if(a == 1)
        {
            int rez = 0;
            for(int i=63; i>=0; i--)checka1(rez, i);
            cout << rez << endl;
        }
        else
        {

        }



    }
}

/*
6 1 3
8 1 2 1 5 4
*/
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 31832 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 15 ms 31836 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 15 ms 31832 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 15 ms 31904 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 15 ms 31836 KB Output isn't correct
2 Halted 0 ms 0 KB -