QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#373740 | #5561. Improving IT | kevinyang# | WA | 1ms | 3836kb | C++17 | 731b | 2024-04-02 03:09:48 | 2024-04-02 03:09:49 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
cin.tie(nullptr)->sync_with_stdio(false);
int n,m;
cin >> n >> m;
vector<int>c(n+1);
vector<vector<int>>a(n+1);
for(int i = 1; i<=n; i++){
cin >> c[i];
int k = min(m,n-i+1);
a[i].push_back(0);
for(int j = 0; j<k; j++){
int x;
cin >> x;
a[i].push_back(x);
}
}
vector<int>dp(n+m+1,(int)1e18);
dp[1] = 0;
for(int i = 1; i<=n; i++){
dp[i]+=c[i];
for(int j = 1; j<a.size(); j++){
dp[i+j] = min(dp[i+j],dp[i]-a[i][j]);
}
}
cout << dp[n+1] << '\n';
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3816kb
input:
4 3 1000 900 800 900 700 600 500 400 1200 1200 1300 600 500
output:
100
result:
ok single line: '100'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
3 2 200 300 400 400 300 200 300 500
output:
-400
result:
ok single line: '-400'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
1 1 145669255 454927004
output:
-309257749
result:
ok single line: '-309257749'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
1 1 639426798 25010755
output:
614416043
result:
ok single line: '614416043'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
4 3 844421851 757954402 420571580 258916750 511274721 404934137 783798589 303312726 476596954 583382039 908112885 504686855 281837844
output:
-238707898
result:
ok single line: '-238707898'
Test #6:
score: -100
Wrong Answer
time: 0ms
memory: 3784kb
input:
4 1 844421851 757954402 420571580 258916750 511274721 404934137 783798589 303312726
output:
507038996
result:
wrong answer 1st lines differ - expected: '834948726', found: '507038996'