QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#100482 | #5561. Improving IT | PetroTarnavskyi# | WA | 2ms | 3368kb | C++17 | 792b | 2023-04-26 15:50:16 | 2023-04-26 15:50:18 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define FOR(i, a, b) for (int i = (a); i<(b); ++i)
#define RFOR(i, b, a) for (int i = (b)-1; i>=(a); --i)
#define MP make_pair
#define PB push_back
#define F first
#define S second
typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
const LL LINF = 1e18;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int n, m;
cin >> n >> m;
vector<LL> dp(n + 2, LINF);
FOR(i, 1, m + 1) {
dp[i] = 0;
}
FOR(i, 1, n + 1) {
int cost;
cin >> cost;
dp[i] += cost;
FOR(j, 1, min(m, n - i + 1) + 1) {
int c;
cin >> c;
dp[i + j] = min(dp[i + j], dp[i] - c);
}
}
cout << dp[n + 1] << "\n";
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 2ms
memory: 3368kb
input:
4 3 1000 900 800 900 700 600 500 400 1200 1200 1300 600 500
output:
-100
result:
wrong answer 1st lines differ - expected: '100', found: '-100'