답안 #245280

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
245280 2020-07-05T23:37:59 Z fivefourthreeone Bali Sculptures (APIO15_sculpture) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#define owo(i,a, b) for(int i=(a); i<(b); ++i)
#define uwu(i,a, b) for(int i=(a)-1; i>=(b); --i)
#define senpai push_back
#define ttgl pair<int, int> 
#define ayaya cout<<"debug"<<endl
 
using namespace std;
using ll = long long;
using ld = long double;
const ll MOD = 1e9+7;
const int INF = 0x3f3f3f3f;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
vector<ll> arr;
vector<ll> psum;
int dp[2002][2002];
int n, a, b;
ll currbest = 0;
bool solve(int bit) {
    ll mx = currbest+(1LL<<bit);
    if(a==1) {
        owo(i, 0, n+1) {
            dp[0][i] = INF;
        }
        dp[0][0] = 0;
        owo(i, 0, n) {
            owo(j, 0, i+1) {
                //cout<<currbest<<" "<<(psum[i+1]-psum[j])<<" "<<(currbest|(psum[i+1]-psum[j]))<<" "<<mx<<"\n";
                if((currbest|(psum[i+1]-psum[j]))<mx) {
                    dp[0][i+1] = min(dp[0][i+1] , dp[0][j] + 1);
                }
            }
        }
        return dp[0][n]>b;
        
    }else {
        owo(i, 0, mxN) {
            owo(j, 0, mxN) {
                dp[i][j] = 0;
            }
        }
        dp[0][0] = 1;
        owo(i, 0, n) {
            owo(j, 0, i+1) {
                if((currbest|(psum[i+1]-psum[j]))<mx) {
                    owo(k, 0, b) {
                        if(dp[j][k]) {
                            dp[i][k+1] = 1;
                        }
                    }
                }
            }
        }
        for(int i=a; i<=b; ++i) {
            if(dp[n][i]) {
                return false;
            }
        }
        return true;
    }
}
int main()
{
    //freopen("filename.in", "r", stdin);
    //freopen("filename.out", "w", stdout);
    cin.tie(0)->sync_with_stdio(0);
    cin>>n>>a>>b;
    arr.resize(n);
    psum.resize(n+1);
    psum[0] = 0;
    owo(i, 0, n) {
        cin>>arr[i];
        psum[i+1] = psum[i] + arr[i];
    }
    uwu(i, 31, 0) {
        if(solve(i)) {
            currbest+=(1LL<<i);
        }
    }
    cout<<currbest<<"\n";
    return 0;
}

Compilation message

sculpture.cpp: In function 'bool solve(int)':
sculpture.cpp:37:19: error: 'mxN' was not declared in this scope
         owo(i, 0, mxN) {
                   ^
sculpture.cpp:2:39: note: in definition of macro 'owo'
 #define owo(i,a, b) for(int i=(a); i<(b); ++i)
                                       ^
sculpture.cpp:37:19: note: suggested alternative: 'mx'
         owo(i, 0, mxN) {
                   ^
sculpture.cpp:2:39: note: in definition of macro 'owo'
 #define owo(i,a, b) for(int i=(a); i<(b); ++i)
                                       ^