21913_Jack'sstruggle

2022-5-16 18:20| 发布者: Hocassian| 查看: 35| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-4-89505953912899-Problem List-采集的数据-后羿采集器.html

Pro.ID

21913

Title

Jack's struggle

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=21913

AC

18

Submit

53

Ratio

33.96%

时间&空间限制

  • Time Limit: 8000/4000 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others)
  • 描述

    A team of airborne troops are ready to complete some missions.

    The battlefield was divided into a grid of n*n, this team can be air-dropped at any place on time 0. In every time unit after landing, they can go to the grid left, right, up or down to the current grid, or they can just stay.

    On their mission list, each mission is described as three integers: t, r and c, represents a task that must be completed exactly at time t on the grid (r, c).

    Obviously, with limits of time, not all missions can be done.

    The captain, Jack, struggling making decisions, wants to know how many missions they can complete at most.

    输入

    The input contains serveral cases:

    For each case:

    * The first line contains two integers n and m, 1 ≤ n ≤ 1000, 1 ≤ m ≤ 10000, n represents the size of the battlefield and m represents the number of missions on the list.

    * Following m lines, each one describes a mission using three integers, t, r and c.

    No two missions have the same t, r and c.

    The input is terminated by n=m=0.

    输出

    Description

    A team of airborne troops are ready to complete some missions.

    The battlefield was divided into a grid of n*n, this team can be air-dropped at any place on time 0. In every time unit after landing, they can go to the grid left, right, up or down to the current grid, or they can just stay.

    On their mission list, each mission is described as three integers: t, r and c, represents a task that must be completed exactly at time t on the grid (r, c).

    Obviously, with limits of time, not all missions can be done.

    The captain, Jack, struggling making decisions, wants to know how many missions they can complete at most.

    Input

    The input contains serveral cases:

    For each case:

    * The first line contains two integers n and m, 1 ≤ n ≤ 1000, 1 ≤ m ≤ 10000, n represents the size of the battlefield and m represents the number of missions on the list.

    * Following m lines, each one describes a mission using three integers, t, r and c.

    No two missions have the same t, r and c.

    The input is terminated by n=m=0.

    Output

    One integer in one line represents the maximum number of mission that can be completed.

    Sample Input

    2 2
    1 1 1
    2 2 2
    0 0

    Sample Output

    1

    Source

    样例输入

    2 2
    1 1 1
    2 2 2
    0 0

    样例输出

    1

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部