답안 #714365

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
714365 2023-03-24T09:43:49 Z vjudge1 Uplifting Excursion (BOI22_vault) C++17
0 / 100
5000 ms 43380 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define OPT ios_base::sync_with_stdio(0); \
            cin.tie(0); \
            cout.tie(0)

#define pii pair<int,int>
#define pll pair<ll,ll>
#define endl "\n"
#define all(v) v.begin(), v.end()
#define mpr make_pair
#define pb push_back
#define ts to_string
#define fi first
#define se second
#define inf 0x3F3F3F3F
#define bpc __builtin_popcount
#define print(v) for(int i = 0; i < v.size(); i++) \
                    cout << v[i] << " "; \
                    cout<<endl;


int main()
{
    int n, L;
    cin >> n >> L;

    set<pii> s;
    int y = 0;

    for (int i = -n; i <= n; i++)
    {
        int x;
        cin >> x;

        if (i == 0)
        {
            y = x;
            continue;
        }
        set<pii> temp;
        for (int k = 1; k <= x; k++)
        {
            temp.insert(mpr(k * i, k));
            for (pii f : s)
            {
                temp.insert(mpr(f.fi + k * i, f.se + k));
            }
        }
        while (!temp.empty())
        {
            int mx = 0;
            int t = (*temp.begin()).fi;
            while (!temp.empty() && (*temp.begin()).fi == t)
            {
                mx = max((*temp.begin()).se, mx);
                temp.erase(temp.begin());
            }
            s.insert(mpr(t, mx));
        }
    }


    if (L == 0)
    {
        cout << y << endl;
        return 0;
    }

    auto it = s.upper_bound(mpr(L, inf));
    it--;
    if ((*it).fi == L) cout << (*it).se + y << endl;
    else cout << "impossible\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 296 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Execution timed out 5070 ms 34912 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 296 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Execution timed out 5070 ms 34912 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Execution timed out 5037 ms 43380 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Execution timed out 5037 ms 43380 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Execution timed out 5037 ms 43380 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 296 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Execution timed out 5070 ms 34912 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Execution timed out 5037 ms 43380 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 296 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Execution timed out 5070 ms 34912 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Execution timed out 5037 ms 43380 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 296 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Execution timed out 5070 ms 34912 KB Time limit exceeded
6 Halted 0 ms 0 KB -