QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#100482#5561. Improving ITPetroTarnavskyi#WA 2ms3368kbC++17792b2023-04-26 15:50:162023-04-26 15:50:18

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-26 15:50:18]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3368kb
  • [2023-04-26 15:50:16]
  • 提交

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'