Submission #739280

# Submission time Handle Problem Language Result Execution time Memory
739280 2023-05-10T09:39:52 Z BidoTeima Bali Sculptures (APIO15_sculpture) C++17
0 / 100
2 ms 340 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);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -