Submission #646327

# Submission time Handle Problem Language Result Execution time Memory
646327 2022-09-29T14:35:22 Z Tenis0206 Bali Sculptures (APIO15_sculpture) C++11
0 / 100
1 ms 328 KB
#include <bits/stdc++.h>

using namespace std;

int n,a,b;

int v[100005];

void solve_1()
{
    int val = 0;
    for(int b=30;b>=0;b--)
    {
        int sum = 0;
        int nr = 1;
        for(int i=1;i<=n;i++)
        {
            if(sum + v[i] <= val + (1<<b))
            {
                sum += v[i];
            }
            else
            {
                sum = v[i];
                ++nr;
            }
        }
        if(nr > b)
        {
            val += (1<<b);
        }
    }
    cout<<val<<'\n';
}

void solve()
{

}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    #ifdef home
    freopen("nr.in","r",stdin);
    freopen("nr.out","w",stdout);
    #endif // home
    cin>>n>>a>>b;
    for(int i=1;i<=n;i++)
    {
        cin>>v[i];
    }
    if(a==1)
    {
        solve_1();
        return 0;
    }
    solve();
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 328 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 328 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 328 KB Output is correct
2 Incorrect 1 ms 324 KB Output isn't correct
3 Halted 0 ms 0 KB -