# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
579715 | 2022-06-19T16:33:00 Z | wdjpng | Uplifting Excursion (BOI22_vault) | C++17 | 5000 ms | 8148 KB |
#include <bits/stdc++.h> #define int long long #define rep(i,n) for(int i = 0; i < n; i++) #define per(i,n) for(int i = n-1; i >=0; i--) #pragma GCC optimize("O3") #pragma optimize("sse,sse2,sse3,sse4,avx,avx2") using namespace std; signed main() { int m,l; cin>>m>>l; int maxl=(m)*(m+1)/2*100; //TODO change to 100 if(l>maxl) {cout<<"impossible\n"; exit(0);} vector<int>dp(2*maxl, -1); dp[maxl]=0; for(int cl = -m; cl <= m; cl++) { int a; cin>>a; rep(whatever,a) { if(cl>0) { per(i,2*maxl+1) { if(i-cl<0||i-cl>=dp.size()||dp[i-cl]==-1) continue; dp[i]=max(dp[i], dp[i-cl]+1); } } else rep(i,2*maxl+1) { if(i-cl<0||i-cl>=dp.size()||dp[i-cl]==-1) continue; dp[i]=max(dp[i], dp[i-cl]+1); } } } if(l+maxl<dp.size()&&dp[l+maxl]>0) cout<<dp[l+maxl]<<'\n'; else cout<<"impossible\n"; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 2 ms | 340 KB | Output is correct |
5 | Correct | 633 ms | 2284 KB | Output is correct |
6 | Correct | 619 ms | 2288 KB | Output is correct |
7 | Correct | 285 ms | 2288 KB | Output is correct |
8 | Correct | 658 ms | 2280 KB | Output is correct |
9 | Correct | 1099 ms | 2284 KB | Output is correct |
10 | Correct | 30 ms | 2308 KB | Output is correct |
11 | Correct | 23 ms | 2308 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 2 ms | 340 KB | Output is correct |
5 | Correct | 633 ms | 2284 KB | Output is correct |
6 | Correct | 619 ms | 2288 KB | Output is correct |
7 | Correct | 285 ms | 2288 KB | Output is correct |
8 | Correct | 658 ms | 2280 KB | Output is correct |
9 | Correct | 1099 ms | 2284 KB | Output is correct |
10 | Correct | 30 ms | 2308 KB | Output is correct |
11 | Correct | 23 ms | 2308 KB | Output is correct |
12 | Correct | 0 ms | 212 KB | Output is correct |
13 | Correct | 0 ms | 212 KB | Output is correct |
14 | Correct | 0 ms | 212 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 566 ms | 2260 KB | Output is correct |
17 | Correct | 618 ms | 2292 KB | Output is correct |
18 | Correct | 256 ms | 2380 KB | Output is correct |
19 | Correct | 584 ms | 2288 KB | Output is correct |
20 | Correct | 1137 ms | 2284 KB | Output is correct |
21 | Correct | 47 ms | 2288 KB | Output is correct |
22 | Correct | 35 ms | 2284 KB | Output is correct |
23 | Correct | 0 ms | 212 KB | Output is correct |
24 | Execution timed out | 5027 ms | 8148 KB | Time limit exceeded |
25 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Incorrect | 1 ms | 212 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Incorrect | 1 ms | 212 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Incorrect | 1 ms | 212 KB | Output isn't correct |
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 | 1 ms | 212 KB | Output is correct |
4 | Correct | 2 ms | 340 KB | Output is correct |
5 | Correct | 633 ms | 2284 KB | Output is correct |
6 | Correct | 619 ms | 2288 KB | Output is correct |
7 | Correct | 285 ms | 2288 KB | Output is correct |
8 | Correct | 658 ms | 2280 KB | Output is correct |
9 | Correct | 1099 ms | 2284 KB | Output is correct |
10 | Correct | 30 ms | 2308 KB | Output is correct |
11 | Correct | 23 ms | 2308 KB | Output is correct |
12 | Correct | 1 ms | 340 KB | Output is correct |
13 | Incorrect | 1 ms | 212 KB | Output isn't correct |
14 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Incorrect | 1 ms | 212 KB | Output isn't correct |
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 | 1 ms | 212 KB | Output is correct |
4 | Correct | 2 ms | 340 KB | Output is correct |
5 | Correct | 633 ms | 2284 KB | Output is correct |
6 | Correct | 619 ms | 2288 KB | Output is correct |
7 | Correct | 285 ms | 2288 KB | Output is correct |
8 | Correct | 658 ms | 2280 KB | Output is correct |
9 | Correct | 1099 ms | 2284 KB | Output is correct |
10 | Correct | 30 ms | 2308 KB | Output is correct |
11 | Correct | 23 ms | 2308 KB | Output is correct |
12 | Correct | 0 ms | 212 KB | Output is correct |
13 | Correct | 0 ms | 212 KB | Output is correct |
14 | Correct | 0 ms | 212 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 566 ms | 2260 KB | Output is correct |
17 | Correct | 618 ms | 2292 KB | Output is correct |
18 | Correct | 256 ms | 2380 KB | Output is correct |
19 | Correct | 584 ms | 2288 KB | Output is correct |
20 | Correct | 1137 ms | 2284 KB | Output is correct |
21 | Correct | 47 ms | 2288 KB | Output is correct |
22 | Correct | 35 ms | 2284 KB | Output is correct |
23 | Correct | 0 ms | 212 KB | Output is correct |
24 | Execution timed out | 5027 ms | 8148 KB | Time limit exceeded |
25 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Incorrect | 1 ms | 212 KB | Output isn't correct |
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 | 1 ms | 212 KB | Output is correct |
4 | Correct | 2 ms | 340 KB | Output is correct |
5 | Correct | 633 ms | 2284 KB | Output is correct |
6 | Correct | 619 ms | 2288 KB | Output is correct |
7 | Correct | 285 ms | 2288 KB | Output is correct |
8 | Correct | 658 ms | 2280 KB | Output is correct |
9 | Correct | 1099 ms | 2284 KB | Output is correct |
10 | Correct | 30 ms | 2308 KB | Output is correct |
11 | Correct | 23 ms | 2308 KB | Output is correct |
12 | Correct | 0 ms | 212 KB | Output is correct |
13 | Correct | 0 ms | 212 KB | Output is correct |
14 | Correct | 0 ms | 212 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 566 ms | 2260 KB | Output is correct |
17 | Correct | 618 ms | 2292 KB | Output is correct |
18 | Correct | 256 ms | 2380 KB | Output is correct |
19 | Correct | 584 ms | 2288 KB | Output is correct |
20 | Correct | 1137 ms | 2284 KB | Output is correct |
21 | Correct | 47 ms | 2288 KB | Output is correct |
22 | Correct | 35 ms | 2284 KB | Output is correct |
23 | Correct | 0 ms | 212 KB | Output is correct |
24 | Execution timed out | 5027 ms | 8148 KB | Time limit exceeded |
25 | Halted | 0 ms | 0 KB | - |