# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
721891 | 2023-04-11T08:29:28 Z | sunnat | Uplifting Excursion (BOI22_vault) | C++14 | 6 ms | 2516 KB |
#include <algorithm> #include <iostream> #include <vector> #include <queue> #include <cmath> #include <map> #include <set> using namespace std; int main(){ vector<int> dp[2]; int n, m, res = -1; cin >> n >> m; vector<int>a(2*n+1); int q = 65000; for(int i = 0; i < a.size(); i ++) cin >> a[i]; dp[1].resize(2*q+1, -1); dp[1][q] = 0; for(int val = -n; val <= n; val ++){ // cout << val << endl; if(val == 0) continue; dp[0] = dp[1]; int v = val + n; for(int cnt = 1; cnt <= a[v]; cnt ++){ for(int sum = -q; sum <= q; sum ++){ if(dp[1][sum+q] != -1) if(-q <= sum+val*cnt && sum+val*cnt <= q) dp[0][sum+val*cnt+q] = max(dp[0][sum+val*cnt+q], dp[1][sum+q] + cnt); } } dp[1] = dp[0]; } if(dp[1][m+q] != -1) cout << dp[1][m+q] + a[n]; else cout << "impossible"; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 1236 KB | Output is correct |
2 | Correct | 2 ms | 1236 KB | Output is correct |
3 | Correct | 1 ms | 1236 KB | Output is correct |
4 | Correct | 4 ms | 1236 KB | Output is correct |
5 | Runtime error | 6 ms | 2516 KB | Execution killed with signal 11 |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 1236 KB | Output is correct |
2 | Correct | 2 ms | 1236 KB | Output is correct |
3 | Correct | 1 ms | 1236 KB | Output is correct |
4 | Correct | 4 ms | 1236 KB | Output is correct |
5 | Runtime error | 6 ms | 2516 KB | Execution killed with signal 11 |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 1236 KB | Output is correct |
2 | Runtime error | 4 ms | 2388 KB | Execution killed with signal 11 |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 1236 KB | Output is correct |
2 | Runtime error | 4 ms | 2388 KB | Execution killed with signal 11 |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 1236 KB | Output is correct |
2 | Runtime error | 4 ms | 2388 KB | Execution killed with signal 11 |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 1236 KB | Output is correct |
2 | Correct | 2 ms | 1236 KB | Output is correct |
3 | Correct | 1 ms | 1236 KB | Output is correct |
4 | Correct | 4 ms | 1236 KB | Output is correct |
5 | Runtime error | 6 ms | 2516 KB | Execution killed with signal 11 |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 1236 KB | Output is correct |
2 | Runtime error | 4 ms | 2388 KB | Execution killed with signal 11 |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 1236 KB | Output is correct |
2 | Correct | 2 ms | 1236 KB | Output is correct |
3 | Correct | 1 ms | 1236 KB | Output is correct |
4 | Correct | 4 ms | 1236 KB | Output is correct |
5 | Runtime error | 6 ms | 2516 KB | Execution killed with signal 11 |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 1236 KB | Output is correct |
2 | Runtime error | 4 ms | 2388 KB | Execution killed with signal 11 |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 1236 KB | Output is correct |
2 | Correct | 2 ms | 1236 KB | Output is correct |
3 | Correct | 1 ms | 1236 KB | Output is correct |
4 | Correct | 4 ms | 1236 KB | Output is correct |
5 | Runtime error | 6 ms | 2516 KB | Execution killed with signal 11 |
6 | Halted | 0 ms | 0 KB | - |