CF63A Sinking Ship(洛谷水题记)

This blog discusses a coding problem where the task is to determine the evacuation order of a sinking ship's crew based on their roles: rats, women/children, men, and the captain. The crew members are identified by unique names and their roles. The solution involves sorting the crew list according to the evacuation priorities." 106590059,8372620,数列分块处理区间操作与查询,"['算法', '数据结构', '区间查询', '数值操作']
摘要由CSDN通过智能技术生成

题目描述

The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All nn crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to nn ) and await further instructions. However, one should evacuate the crew properly, in a strict order. Specifically:

The first crew members to leave the ship are rats. Then women and children (both groups have the same priority) leave the ship. After that all men are evacuated from the ship. The captain leaves the sinking ship last.

If we cannot determine exactly who should leave the ship first for any two members of the crew by the rules from the previous paragraph, then the one who stands to the left in the line leaves the ship first (or in other words, the one whose number in the line is less).

For each crew member we know his status as a crew member, and also his name. All crew members have different names. Determi

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值