社区讨论

为何CE(蒟蒻一个)

P2285[HNOI2004] 打鼹鼠参与者 3已保存回复 5

讨论操作

快速查看讨论及其快照的属性,并进行相关操作。

当前回复
5 条
当前快照
1 份
快照标识符
@miq2hjc4
此快照首次捕获于
2025/12/03 21:53
3 个月前
此快照最后确认于
2025/12/06 09:35
3 个月前
查看原帖
为何CE
CPP
#include<bits/stdc++.h>
using namespace std;
int n, m, f[10005], ans;
struct node{
  int t, x, y;  
}a[10005];
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
    cin >> n >> m;
    for(int i = 1; i <= m; i ++){
        cin >> a[i].t >> a[i].x >> a[i].y;
    }
    for(int i = 1; i <= m; i ++){
        f[i] = 1;
        for(int j = 1; j < i; j ++){
            int e = abs(a[i].x - a[j].x) + abs(a[i].y - a[j].y);
            int f = a[i].t - a[j].t;
            if(f >= e){
                f[i] = max(f[j] + 1, f[i]);
            }
        }
        ans = max(ans, f[i]);
    }
    cout << ans << "\n";
    return 0;
}

回复

5 条回复,欢迎继续交流。

正在加载回复...