Run ID:72568

提交时间:2024-05-11 10:59:55

def intercept_missiles(heights): if not heights: return 0 total_result = [] result = [heights[0]] intercept_count = 1 max_height = heights[0] for height in heights[1:]: if height > max_height: total_result.append(result) result = [height] intercept_count += 1 else: result.append(height) max_height = height total_result.append(result) return total_result, intercept_count def main(): heights = list(map(int, input().split())) r, cnt = intercept_missiles(heights) print(cnt) if __name__ == "__main__": main()