牛客459000288号
牛客459000288号
全部文章
分类
题解(9)
归档
标签
去牛客网
登录
/
注册
牛客459000288号的博客
全部文章
(共34篇)
题解 | 相差不超过k的最多数
n, k = map(int, input().split()) arr = list(map(int, input().split())) # Algo arr.sort() maxLen = 0 arr.append(1e10) # Sentinel n += 1 i = 0 for j i...
2026-01-09
0
5
题解 | 游游的最长稳定子数组
n = int(input()) arr = list(map(int, input().split())) # Algo i = 0 maxLen = 1 arr.append(1e10) # Sentinel n += 1 for j in range(n-1): if abs(ar...
2026-01-09
0
4
题解 | 小苯的IDE括号问题(easy)
n, k = map(int, input().split()) s = input() oprs = [input() for _ in range(k)] # Algo arr = list(s) ic = arr.index('I') i, j = ic-1, ic+1 for opr in...
2026-01-09
0
5
题解 | 【模板】双指针
n = int(input()) arr = list(map(int, input().split())) res = [] occ = [-1] * n maxLen = -1 i = 0 arr.append(arr[-1]) # Sentinel n += 1 for j in rang...
2026-01-09
0
5
题解 | 走一个大整数迷宫
from collections import deque # Process input n, m, p = map(int, input().split()) ma = [list(map(int, input().split())) for _ in range(n)] mb = [list...
2026-01-09
0
5
题解 | 时津风的资源收集
from collections import deque # Build distance matrix dist = [float("inf")] * 301 dist[10] = 0 dist[300] = 1 q = deque() q.append(10) q.app...
2026-01-09
0
6
题解 | 太阳系DISCO
from collections import deque # Input n, k, a, b, x, y = map(int, input().split()) # BFS q = deque() q.append((a, 0, k)) visited = [False] * n minTi...
2026-01-08
0
6
题解 | 迷宫
from collections import deque # Process input m, n = map(int, input().split()) mat = [None] * m start = None end = None for i in range(m): mat[i]...
2026-01-08
0
4
题解 | 迷宫问题
h, w = map(int, input().split()) mat = [list(map(int, input().split())) for _ in range(h)] # Algo def dfs(mat, i, j, path): if i+j == w+h-1: ...
2026-01-08
0
7
题解 | 火车进站
# Process input n = int(input()) ax = input().split() # DFS def dfs(arr, i, station, seq, orders): if i == len(arr) and not station: orde...
2026-01-08
0
10
首页
上一页
1
2
3
4
下一页
末页