赞
踩
import os import sys n, m = map(int, input().split()) d = [[0] * (n + 2) for _ in range(n + 2)] for _ in range(m): x1, y1, x2, y2 = map(int, input().split()) d[x1][y1] += 1 d[x2 + 1][y1] -= 1 d[x1][y2 + 1] -= 1 d[x2 + 1][y2 + 1] += 1 for i in range(1, n + 1): for j in range(1, n + 1): d[i][j] += d[i - 1][j] + d[i][j - 1] - d[i - 1][j - 1] if d[i][j] % 2 == 0: print(0, end = "") else: print(1, end = "") print()
import os import sys ''' ans = 0 for i in range(12345678, 98765433): s = str(i) find = s.find("2") if find == -1: continue find0 = s.find("0", find + 1) if find0 == -1: continue find2 = s.find("2", find0 + 1) if find2 == -1: continue find3 = s.find("3", find2 + 1) if find3 == -1: continue ans += 1 print(98765432 - 12345678 + 1 - ans) ''' print(85959030)
import os
import sys
result = [0] * 4047
for i in range(1, 2024):
for j in range(i + 1, 2024):
result[i + j] += i
print(max(result))
import os
import sys
s = input()
dp = [0] * len(s)
for i in range(len(s)):
if i == 0:
dp[i] = ord(s[0]) - 96
elif i == 1:
dp[i] = max(ord(s[0]) - 96, ord(s[1]) - 96)
else:
dp[i] = max(dp[i - 1], dp[i - 2] + ord(s[i]) - 96)
print(dp[-1])
import os import sys def check(mid): ans = [] for l, s in d: tmp = mid - s if tmp >= 0: ans.append((l - tmp, l + tmp)) ans.sort() res = ans[0][1] for i in range(1, len(ans)): if ans[i][0] - res <= 1: res = max(res, ans[i][1]) else: break return res < lens n, lens = map(int, input().split()) d = [] for _ in range(n): l, s = map(int, input().split()) d.append((l, s)) left, right = 1, 10 ** 9 while left < right: mid = (left + right) // 2 if check(mid): left = mid + 1 else: right = mid print(left)
import os import sys n = int(input()) x = list(map(int, input())) y = list(map(int, input())) x = [0] + x[: : -1] y = [0] + y[: : -1] INF = 1 << 64 dp = [[INF] * 3 for _ in range(n + 1)] dp[1][0] = abs(x[1] - y[1]) dp[1][1] = 10 + y[1] - x[1] dp[1][2] = 10 + x[1] - y[1] for i in range(2, n + 1): dp[i][0] = min(abs(x[i] - y[i]) + dp[i - 1][0], abs(x[i] + 1 - y[i]) + dp[i - 1][1], abs(x[i] -1 - y[i]) + dp[i - 1][2]) dp[i][1] = min(10 + y[i] - x[i] + dp[i - 1][0], 10 + y[i] - (x[i] + 1) + dp[i - 1][1], 10 + y[i] - (x[i] - 1) + dp[i - 1][2]) dp[i][2] = min(10 + x[i] - y[i] + dp[i - 1][0], 10 + (x[i] + 1) - y[i] + dp[i - 1][1], 10 + (x[i] - 1) - y[i] + dp[i - 1][2]) print(min(dp[n][0], dp[n][1], dp[n][2]))
未完待续…
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。