数组大小 与 数据范围 相悖

P1065 [NOIP2006 提高组] 作业调度方案

**另有:** $#6$ 答案 $109$ , 我的输出 $107$ 。 输入如下 ``` 7 8 6 8 4 8 3 3 6 3 2 1 6 7 6 6 6 5 2 8 1 3 3 8 7 3 4 1 7 2 4 5 1 1 4 4 8 7 4 7 2 5 2 7 4 5 1 2 6 2 5 1 5 8 5 7 3 8 1 2 3 4 5 6 7 2 3 4 5 6 7 1 4 5 6 7 3 2 1 1 2 3 4 7 6 5 1 2 3 4 6 5 7 4 5 3 2 1 6 7 7 5 6 4 3 2 1 2 3 4 5 1 6 7 5 6 8 9 4 3 6 5 6 7 8 9 10 13 3 4 11 3 4 5 6 10 3 5 6 11 12 8 4 5 6 7 8 19 2 4 5 8 7 9 4 10 3 5 9 8 6 7 8 5 8 6 7 10 3 4 ``` 有遇类似 $bug$ 请指出可能出错的思路,代码又长又臭令人作呕故不贴了!
by Smiog @ 2023-07-11 15:14:48


@[Smiog](/user/399493) **更正** 应该是 $n,m<20$ 至多有 $19\times19\times20=7220$ 个元素
by Smiog @ 2023-07-11 15:21:31


原问题已解决 差#6
by Smiog @ 2023-07-11 15:23:53


有没有可能是机器没法塞下那段完整的工作时间,要确认整段时间都空闲然后再分配给某个工序,我是这样错的\n 如果只相差2,会不会是某个变量值多减了1
by melting_moon @ 2023-07-21 22:52:23


@[melting_moon](/user/240796) 谢谢 $!$ #6 read : $7 $ expected : $9$ 确实差 $2$ 。我没找到哪个变量多减,但为什么其它点能过?
by Smiog @ 2023-07-23 12:52:10


我测过了能想到的一些极端情况,还有哪个易错点我没考虑到的...
by Smiog @ 2023-07-23 12:53:15


@[Smiog](/user/399493) 我的代码思路和你一模一样,原本也是WA了#6,debug 完后过了,这里贴上我的代码 ```cpp #include <iostream> #include <cstdio> #define LEN 25 #define SPAN 100005 int N, M, ord[405], m[LEN][LEN], t[LEN][LEN], cnt[LEN], lst[LEN], maxt[LEN], vis[LEN][SPAN]; int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); std::cout.tie(nullptr); // std::freopen("input.txt", "r", stdin); // std::freopen("output.txt", "w", stdout); std::cin >> M >> N; for (int i = 1; i <= M * N; i++) std::cin >> ord[i]; for (int i = 1; i <= N; i++) for (int j = 1; j <= M; j++) std::cin >> m[i][j]; for (int i = 1; i <= N; i++) for (int j = 1; j <= M; j++) std::cin >> t[i][j]; for (int i = 1; i <= M * N; i++) { cnt[ord[i]]++; int l, r; for (l = lst[ord[i]] + 1, r = l + t[ord[i]][cnt[ord[i]]] - 1; l <= r; l++) { if (vis[m[ord[i]][cnt[ord[i]]]][l]) r = l + t[ord[i]][cnt[ord[i]]]; } for (l = r - t[ord[i]][cnt[ord[i]]] + 1; l <= r; l++) vis[m[ord[i]][cnt[ord[i]]]][l] = true; lst[ord[i]] = r; if (r > maxt[m[ord[i]][cnt[ord[i]]]]) maxt[m[ord[i]][cnt[ord[i]]]] = r; } int ans = maxt[1]; for (int i = 2; i <= M; i++) if (maxt[i] > ans) ans = maxt[i]; std::cout << ans << std::endl; return 0; } ``` 看过你的代码后我发现这段有问题 ```cpp return maxtime[jq] = ptr - 1; ``` 这里 `ptr - 1` 是操作的结束时间,但由于操作可以插入到见面的空档,机器的 `maxtime` 不一定等于该结束时间。 ------------ ~~毒瘤数据弱的要死,辣么大个 bug 只爆一个点~~
by inawah @ 2023-07-28 13:51:00


@[inawah](/user/1042117) 附上前后两次提交作对比: - [WA#6](https://www.luogu.com.cn/record/117814423) - [AC](https://www.luogu.com.cn/record/117817530)
by inawah @ 2023-07-28 13:53:13


@[Smiog](/user/399493) 感谢贴上的数据
by inawah @ 2023-07-28 13:54:16


@[inawah](/user/1042117) 感谢!共同进步
by Smiog @ 2023-07-28 14:57:17


| 下一页