답안 #572983

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
572983 2022-06-05T15:19:03 Z AmirElarbi Uplifting Excursion (BOI22_vault) C++14
5 / 100
1000 ms 333756 KB
#include <bits/stdc++.h>
#define vi vector<int>
#define ve vector
#define ll long long
#define vf vector<float>
#define vll vector<pair<ll,ll>>
#define ii pair<int,int>
#define vvi vector<vi>
#define vii vector<ii>
#define gii greater<ii>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define INF 1e9
#define eps 1e-7
#define eps1 1e-2
#define optimise ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MAX_A 2e5+5
using namespace std;
const int MOD = 1e4+7;
const int nax = 105;
const int nax2 = 200005;
typedef complex<int> Point;
#define X real()
#define Y imag()
int s[nax], dp[nax2*2][nax],m,l;
int solve(int sm, int pos){
    if(pos > 2*m){
        if(sm == l) return 0;
        else return -INF;
    }
         //cout << "YES" << endl; 
    if(sm > l && pos > m) return -INF;
    //if(sm+nax2 < 0)
    if(dp[sm+nax2][pos] != -1) return dp[sm+nax2][pos];
    dp[sm+nax2][pos] = -INF;
    for (int i = 0; i <= s[pos]; ++i)
    {
        int a = solve(sm+(pos-m)*i,pos+1);
        if(a!=-INF) dp[sm+nax2][pos] = max(dp[sm+nax2][pos], a+i );
    }
    return dp[sm+nax2][pos];
}
int main(){
    optimise;
    cin >> m >> l;
    for (int i = 0; i < 2*m+1; ++i)
    {
        cin >> s[i];
    }
    int res = 0;
    memset(dp, -1,sizeof dp);
    res = solve(0,0);
    if(res == -INF) cout << "impossible" << endl;
    else cout << res << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 58 ms 164648 KB Output is correct
2 Correct 61 ms 164632 KB Output is correct
3 Correct 59 ms 164684 KB Output is correct
4 Correct 62 ms 164668 KB Output is correct
5 Correct 62 ms 164664 KB Output is correct
6 Correct 582 ms 164564 KB Output is correct
7 Correct 86 ms 164684 KB Output is correct
8 Correct 394 ms 164780 KB Output is correct
9 Correct 914 ms 164696 KB Output is correct
10 Correct 59 ms 164684 KB Output is correct
11 Correct 62 ms 164664 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 58 ms 164648 KB Output is correct
2 Correct 61 ms 164632 KB Output is correct
3 Correct 59 ms 164684 KB Output is correct
4 Correct 62 ms 164668 KB Output is correct
5 Correct 62 ms 164664 KB Output is correct
6 Correct 582 ms 164564 KB Output is correct
7 Correct 86 ms 164684 KB Output is correct
8 Correct 394 ms 164780 KB Output is correct
9 Correct 914 ms 164696 KB Output is correct
10 Correct 59 ms 164684 KB Output is correct
11 Correct 62 ms 164664 KB Output is correct
12 Correct 60 ms 164580 KB Output is correct
13 Correct 60 ms 164684 KB Output is correct
14 Correct 66 ms 164612 KB Output is correct
15 Correct 60 ms 164612 KB Output is correct
16 Correct 68 ms 164684 KB Output is correct
17 Correct 603 ms 164688 KB Output is correct
18 Correct 78 ms 164700 KB Output is correct
19 Correct 410 ms 164768 KB Output is correct
20 Correct 1000 ms 164936 KB Output is correct
21 Correct 61 ms 164688 KB Output is correct
22 Correct 59 ms 164684 KB Output is correct
23 Runtime error 197 ms 333756 KB Execution killed with signal 11
24 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 60 ms 164740 KB Output is correct
2 Incorrect 59 ms 164688 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 60 ms 164740 KB Output is correct
2 Incorrect 59 ms 164688 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 60 ms 164740 KB Output is correct
2 Incorrect 59 ms 164688 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 58 ms 164648 KB Output is correct
2 Correct 61 ms 164632 KB Output is correct
3 Correct 59 ms 164684 KB Output is correct
4 Correct 62 ms 164668 KB Output is correct
5 Correct 62 ms 164664 KB Output is correct
6 Correct 582 ms 164564 KB Output is correct
7 Correct 86 ms 164684 KB Output is correct
8 Correct 394 ms 164780 KB Output is correct
9 Correct 914 ms 164696 KB Output is correct
10 Correct 59 ms 164684 KB Output is correct
11 Correct 62 ms 164664 KB Output is correct
12 Correct 60 ms 164740 KB Output is correct
13 Incorrect 59 ms 164688 KB Output isn't correct
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 60 ms 164740 KB Output is correct
2 Incorrect 59 ms 164688 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 58 ms 164648 KB Output is correct
2 Correct 61 ms 164632 KB Output is correct
3 Correct 59 ms 164684 KB Output is correct
4 Correct 62 ms 164668 KB Output is correct
5 Correct 62 ms 164664 KB Output is correct
6 Correct 582 ms 164564 KB Output is correct
7 Correct 86 ms 164684 KB Output is correct
8 Correct 394 ms 164780 KB Output is correct
9 Correct 914 ms 164696 KB Output is correct
10 Correct 59 ms 164684 KB Output is correct
11 Correct 62 ms 164664 KB Output is correct
12 Correct 60 ms 164580 KB Output is correct
13 Correct 60 ms 164684 KB Output is correct
14 Correct 66 ms 164612 KB Output is correct
15 Correct 60 ms 164612 KB Output is correct
16 Correct 68 ms 164684 KB Output is correct
17 Correct 603 ms 164688 KB Output is correct
18 Correct 78 ms 164700 KB Output is correct
19 Correct 410 ms 164768 KB Output is correct
20 Correct 1000 ms 164936 KB Output is correct
21 Correct 61 ms 164688 KB Output is correct
22 Correct 59 ms 164684 KB Output is correct
23 Runtime error 197 ms 333756 KB Execution killed with signal 11
24 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 60 ms 164740 KB Output is correct
2 Incorrect 59 ms 164688 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 58 ms 164648 KB Output is correct
2 Correct 61 ms 164632 KB Output is correct
3 Correct 59 ms 164684 KB Output is correct
4 Correct 62 ms 164668 KB Output is correct
5 Correct 62 ms 164664 KB Output is correct
6 Correct 582 ms 164564 KB Output is correct
7 Correct 86 ms 164684 KB Output is correct
8 Correct 394 ms 164780 KB Output is correct
9 Correct 914 ms 164696 KB Output is correct
10 Correct 59 ms 164684 KB Output is correct
11 Correct 62 ms 164664 KB Output is correct
12 Correct 60 ms 164580 KB Output is correct
13 Correct 60 ms 164684 KB Output is correct
14 Correct 66 ms 164612 KB Output is correct
15 Correct 60 ms 164612 KB Output is correct
16 Correct 68 ms 164684 KB Output is correct
17 Correct 603 ms 164688 KB Output is correct
18 Correct 78 ms 164700 KB Output is correct
19 Correct 410 ms 164768 KB Output is correct
20 Correct 1000 ms 164936 KB Output is correct
21 Correct 61 ms 164688 KB Output is correct
22 Correct 59 ms 164684 KB Output is correct
23 Runtime error 197 ms 333756 KB Execution killed with signal 11
24 Halted 0 ms 0 KB -