답안 #103569

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
103569 2019-03-31T14:38:37 Z Darksinian Bali Sculptures (APIO15_sculpture) C++14
0 / 100
3 ms 388 KB
#include <bits/stdc++.h>
using namespace std;
const int N = 2002;
long long Arr[N];
long long pre[N];
int main()
{
    ios_base::sync_with_stdio(false);
    int n,a,b;
    cin >> n >> a >> b;
    set<int> x;
    for(int i =1;i<=n;i++) {
        cin >> Arr[i];
        pre[i] = Arr[i] + pre[i-1];
    }
    pre[n+1] = pre[n];
    x.insert(1);
    x.insert(n+1);

    long long ans = pre[n];
    while(b--) {
        int ind = 0;
        long long temp =ans;
        for(int i =2;i<=n;i++) {
            if(x.count(i)) continue;
            x.insert(i);
            auto j = x.begin();
            long long tt = 0;
            j++;
            for(;j!=x.end();j++) {
                auto z = j;
                z--;
                tt |= pre[*j-1] - pre[*z-1];
            }
            x.erase(i);
            if(tt <= temp) {
                temp = tt;
                ind = i;
            }
        }
        ans = temp;
        x.insert(ind);
    }
    cout << ans;

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 388 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Incorrect 3 ms 384 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Incorrect 2 ms 384 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Incorrect 3 ms 384 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Incorrect 2 ms 384 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Incorrect 3 ms 384 KB Output isn't correct
6 Halted 0 ms 0 KB -