답안 #721856

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
721856 2023-04-11T07:55:45 Z kas_s Uplifting Excursion (BOI22_vault) C++17
0 / 100
5000 ms 524288 KB
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;

int main () {
    ios::sync_with_stdio(0); cin.tie(0);
    int M; long long L;
    cin >> M >> L;
    map<long long, long long> sums;
    sums[0] = 0;
    vector<int> a;
    for (int i = -M, x; i <= M; i++) {
        cin >> x;
        for (int j = 0; j < x; j++) {
            a.push_back(i);
        }
    }
    int N = (int)a.size();
    for (int i = 0; i < N; i++) {
        map<long long, long long> curr;
        for (auto &[k, v]: sums) {
            curr[a[i] + k] = max(curr[a[i] + k], v + 1);
        }
        for (auto &[k, v]: curr) {
            sums[k] = max(sums[k], v);
        }
    }
    if (sums.count(L)) {
        cout << sums[L] << '\n';
    } else {
        cout << "impossible\n";
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Execution timed out 5023 ms 4380 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Execution timed out 5023 ms 4380 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Runtime error 515 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Runtime error 515 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Runtime error 515 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Execution timed out 5023 ms 4380 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Runtime error 515 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Execution timed out 5023 ms 4380 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Runtime error 515 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Execution timed out 5023 ms 4380 KB Time limit exceeded
6 Halted 0 ms 0 KB -