QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#96866#5561. Improving IT_b_WA 1ms7740kbC++14904b2023-04-15 17:01:132023-04-15 17:01:17

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-15 17:01:17]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:7740kb
  • [2023-04-15 17:01:13]
  • 提交

answer

#include<iostream>
#include<string.h>
using namespace std;
const int MAXN = 5e5 + 50;
#define ll long long
struct Edge {
	int x, y, w;
}edge[MAXN];
int n, m, bian;
ll dist[MAXN];
ll solve(int s, int t) {
	memset(dist, 127, sizeof(dist));
	dist[s] = 0;
	for (;;) {
		bool ok = false;
		for (int i = 1; i <= bian; i++) {
			int x = edge[i].x; int y = edge[i].y; int w = edge[i].w;
			if (dist[x] < 1 << 62) {
				if (dist[x] + w < dist[y]) {
					dist[y] = dist[x] + w;
					ok = true;
				}
			}
		}
		if (!ok)
			break;
	}
	return dist[t];
}
int main() {
	cin >> n >> m;
	int cnt = 0;
	for (int i = 1; i <= n; i++) {
		int cost; cin >> cost; int sale;
		for (int j = 0; j < min(m, n - i + 1); j++) {
			cin >> sale;
			edge[++cnt].x = i; edge[cnt].y = i + j + 1;
			edge[cnt].w = cost - sale;
		}
	}
	bian = cnt;
	cout << solve(1, n + 1) << endl;

	return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 7740kb

input:

4 3
1000 900 800 900
700 600 500 400
1200 1200 1300
600 500

output:

9187201950435737471

result:

wrong answer 1st lines differ - expected: '100', found: '9187201950435737471'