QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#523323#4207. Uplifting ExcursionModyKachef0 3ms202968kbC++23821b2024-08-18 06:33:202024-08-18 06:33:22

Judging History

你现在查看的是最新测评结果

  • [2024-08-18 06:33:22]
  • 评测
  • 测评结果:0
  • 用时:3ms
  • 内存:202968kb
  • [2024-08-18 06:33:20]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long 

int dp[101][101*50*50] ; 
int m , L;
int a[201]; 

int brute(int i , int s){
    if (i == m+1) {
        if (s == L) return 0; 
        else return -1e18; 
    }
    if (dp[i+50][s + 50*50*50] != -1) return dp[i+100][s + 50*50*50]; 
    int ans = -1e18;
    for (int j = 0 ; j <= a[i+50] ; j++){
        ans = max(ans , brute(i+1 , s + j * i) + j); 
    }   
    return dp[i+50][s + 50*50*50] = ans;
}

void doWork(){
    cin >> m >> L;
    for (int i = -m ; i <= m ; i++){
        cin >> a[i+50]; 
    }
    int x = brute(-m , 0); 
    if (x < 0) {cout << "impossible";}
    else cout << x ; 
}

signed main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    memset(dp , -1 , sizeof dp); 
    doWork(); 
}

詳細信息

Subtask #1:

score: 0
Runtime Error

Test #1:

score: 5
Accepted
time: 3ms
memory: 202968kb

input:

1 5
0 0 6

output:

5

result:

ok single line: '5'

Test #2:

score: 0
Runtime Error

input:

50 2303
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 3 5 25 50 0

output:


result:


Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Runtime Error

Test #19:

score: 0
Runtime Error

input:

30 38887954194235
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 444113827766 26 511237030935 22 696666627923 315938808146 20 952560827478 924020644151 850666790939 23 587888300072 23 797812801251 911390834853 677171102320 4 2 22 950650764450 278888113729 23 15 15 13 9 637120041802 20 1...

output:


result:


Subtask #4:

score: 0
Skipped

Dependency #3:

0%

Subtask #5:

score: 0
Skipped

Dependency #3:

0%

Subtask #6:

score: 0
Skipped

Dependency #5:

0%

Subtask #7:

score: 0
Skipped

Dependency #5:

0%

Subtask #8:

score: 0
Skipped

Dependency #6:

0%

Subtask #9:

score: 0
Skipped

Dependency #7:

0%

Subtask #10:

score: 0
Skipped

Dependency #1:

0%