# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
603149 | 2022-07-23T16:04:38 Z | DanerZein | Uplifting Excursion (BOI22_vault) | C++14 | 5000 ms | 7892 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MAX_L=505000; const int MAX_N=110; vector<int> mapo(MAX_L); vector<int> mane(MAX_L); void maxObjects(vector<int> &x, vector<int> &dp,const int MAX_L){ for(int i=0;i<x.size();i++){ if(x[i]==0) continue; vector<int> spa; for(int j=0;j<=MAX_L;j++){ if(dp[j]!=0) spa.push_back(j); } for(int j=0;j<spa.size();j++){ for(int k=1;k<=x[i];k++){ dp[spa[j]+(i+1)*k]=max(dp[spa[j]+(i+1)*k],dp[spa[j]]+k); } } for(int k=1;k<=x[i];k++){ dp[(i+1)*k]=max(dp[(i+1)*k],k); } } } int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n; ll L; cin>>n>>L; vector<int> neg; for(int i=0;i<n;i++){ int a; cin>>a; neg.push_back(a); } reverse(neg.begin(),neg.end()); int c0; cin>>c0; vector<int> pos; for(int i=0;i<n;i++){ int a; cin>>a; pos.push_back(a); } //const int MAX_L=(n*(n+1)/2)*n; if(abs(L)>MAX_L){ cout<<"impossible\n"; return 0; } mapo[0]=mane[0]=c0; maxObjects(neg,mane,MAX_L); maxObjects(pos,mapo,MAX_L); int ans; if(L>0) ans=mapo[L]; else ans=mane[abs(L)]; for(int i=0;i<=MAX_L;i++){ int d=i-L; if(d>=0 && mane[d]!=0 && mapo[i]!=0){ ans=max(ans,mapo[i]+mane[d]-c0); } } if(ans==0) cout<<"impossible\n"; else cout<<ans<<endl; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 4180 KB | Output is correct |
2 | Correct | 6 ms | 4180 KB | Output is correct |
3 | Correct | 4 ms | 4180 KB | Output is correct |
4 | Correct | 13 ms | 4292 KB | Output is correct |
5 | Correct | 2 ms | 4180 KB | Output is correct |
6 | Correct | 268 ms | 4636 KB | Output is correct |
7 | Correct | 89 ms | 4372 KB | Output is correct |
8 | Correct | 253 ms | 4664 KB | Output is correct |
9 | Correct | 477 ms | 4760 KB | Output is correct |
10 | Correct | 5 ms | 4180 KB | Output is correct |
11 | Correct | 10 ms | 4288 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 4180 KB | Output is correct |
2 | Correct | 6 ms | 4180 KB | Output is correct |
3 | Correct | 4 ms | 4180 KB | Output is correct |
4 | Correct | 13 ms | 4292 KB | Output is correct |
5 | Correct | 2 ms | 4180 KB | Output is correct |
6 | Correct | 268 ms | 4636 KB | Output is correct |
7 | Correct | 89 ms | 4372 KB | Output is correct |
8 | Correct | 253 ms | 4664 KB | Output is correct |
9 | Correct | 477 ms | 4760 KB | Output is correct |
10 | Correct | 5 ms | 4180 KB | Output is correct |
11 | Correct | 10 ms | 4288 KB | Output is correct |
12 | Correct | 8 ms | 4180 KB | Output is correct |
13 | Correct | 7 ms | 4180 KB | Output is correct |
14 | Correct | 4 ms | 4288 KB | Output is correct |
15 | Correct | 14 ms | 4292 KB | Output is correct |
16 | Correct | 2 ms | 4180 KB | Output is correct |
17 | Correct | 258 ms | 4504 KB | Output is correct |
18 | Correct | 85 ms | 4308 KB | Output is correct |
19 | Correct | 256 ms | 4588 KB | Output is correct |
20 | Correct | 548 ms | 4756 KB | Output is correct |
21 | Correct | 5 ms | 4180 KB | Output is correct |
22 | Correct | 10 ms | 4292 KB | Output is correct |
23 | Correct | 2 ms | 4180 KB | Output is correct |
24 | Correct | 3335 ms | 6284 KB | Output is correct |
25 | Correct | 577 ms | 5196 KB | Output is correct |
26 | Execution timed out | 5064 ms | 7892 KB | Time limit exceeded |
27 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 17 ms | 4288 KB | Output is correct |
2 | Incorrect | 2 ms | 4180 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 17 ms | 4288 KB | Output is correct |
2 | Incorrect | 2 ms | 4180 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 17 ms | 4288 KB | Output is correct |
2 | Incorrect | 2 ms | 4180 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 4180 KB | Output is correct |
2 | Correct | 6 ms | 4180 KB | Output is correct |
3 | Correct | 4 ms | 4180 KB | Output is correct |
4 | Correct | 13 ms | 4292 KB | Output is correct |
5 | Correct | 2 ms | 4180 KB | Output is correct |
6 | Correct | 268 ms | 4636 KB | Output is correct |
7 | Correct | 89 ms | 4372 KB | Output is correct |
8 | Correct | 253 ms | 4664 KB | Output is correct |
9 | Correct | 477 ms | 4760 KB | Output is correct |
10 | Correct | 5 ms | 4180 KB | Output is correct |
11 | Correct | 10 ms | 4288 KB | Output is correct |
12 | Correct | 17 ms | 4288 KB | Output is correct |
13 | Incorrect | 2 ms | 4180 KB | Output isn't correct |
14 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 17 ms | 4288 KB | Output is correct |
2 | Incorrect | 2 ms | 4180 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 4180 KB | Output is correct |
2 | Correct | 6 ms | 4180 KB | Output is correct |
3 | Correct | 4 ms | 4180 KB | Output is correct |
4 | Correct | 13 ms | 4292 KB | Output is correct |
5 | Correct | 2 ms | 4180 KB | Output is correct |
6 | Correct | 268 ms | 4636 KB | Output is correct |
7 | Correct | 89 ms | 4372 KB | Output is correct |
8 | Correct | 253 ms | 4664 KB | Output is correct |
9 | Correct | 477 ms | 4760 KB | Output is correct |
10 | Correct | 5 ms | 4180 KB | Output is correct |
11 | Correct | 10 ms | 4288 KB | Output is correct |
12 | Correct | 8 ms | 4180 KB | Output is correct |
13 | Correct | 7 ms | 4180 KB | Output is correct |
14 | Correct | 4 ms | 4288 KB | Output is correct |
15 | Correct | 14 ms | 4292 KB | Output is correct |
16 | Correct | 2 ms | 4180 KB | Output is correct |
17 | Correct | 258 ms | 4504 KB | Output is correct |
18 | Correct | 85 ms | 4308 KB | Output is correct |
19 | Correct | 256 ms | 4588 KB | Output is correct |
20 | Correct | 548 ms | 4756 KB | Output is correct |
21 | Correct | 5 ms | 4180 KB | Output is correct |
22 | Correct | 10 ms | 4292 KB | Output is correct |
23 | Correct | 2 ms | 4180 KB | Output is correct |
24 | Correct | 3335 ms | 6284 KB | Output is correct |
25 | Correct | 577 ms | 5196 KB | Output is correct |
26 | Execution timed out | 5064 ms | 7892 KB | Time limit exceeded |
27 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 17 ms | 4288 KB | Output is correct |
2 | Incorrect | 2 ms | 4180 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 4180 KB | Output is correct |
2 | Correct | 6 ms | 4180 KB | Output is correct |
3 | Correct | 4 ms | 4180 KB | Output is correct |
4 | Correct | 13 ms | 4292 KB | Output is correct |
5 | Correct | 2 ms | 4180 KB | Output is correct |
6 | Correct | 268 ms | 4636 KB | Output is correct |
7 | Correct | 89 ms | 4372 KB | Output is correct |
8 | Correct | 253 ms | 4664 KB | Output is correct |
9 | Correct | 477 ms | 4760 KB | Output is correct |
10 | Correct | 5 ms | 4180 KB | Output is correct |
11 | Correct | 10 ms | 4288 KB | Output is correct |
12 | Correct | 8 ms | 4180 KB | Output is correct |
13 | Correct | 7 ms | 4180 KB | Output is correct |
14 | Correct | 4 ms | 4288 KB | Output is correct |
15 | Correct | 14 ms | 4292 KB | Output is correct |
16 | Correct | 2 ms | 4180 KB | Output is correct |
17 | Correct | 258 ms | 4504 KB | Output is correct |
18 | Correct | 85 ms | 4308 KB | Output is correct |
19 | Correct | 256 ms | 4588 KB | Output is correct |
20 | Correct | 548 ms | 4756 KB | Output is correct |
21 | Correct | 5 ms | 4180 KB | Output is correct |
22 | Correct | 10 ms | 4292 KB | Output is correct |
23 | Correct | 2 ms | 4180 KB | Output is correct |
24 | Correct | 3335 ms | 6284 KB | Output is correct |
25 | Correct | 577 ms | 5196 KB | Output is correct |
26 | Execution timed out | 5064 ms | 7892 KB | Time limit exceeded |
27 | Halted | 0 ms | 0 KB | - |