ManuShi98

真彩希帆のファン


  • Home

  • About

  • Tags

  • Categories

  • Archives

  • Search

CodeForces - 1874B Jellyfish and Math

Posted on 2023-10-02 | In 算法 , BFS

题意

给定5个数字a, b, c, d, m, 通过对a,b进行以下4种操作,问最少几步能够将(a, b) 转化为(c, d)

  • x = x & y
  • x = x | y
  • y = x ^ y
  • y = y ^ m
Read more »

CodeForces - 1762C Binary Strings are Fun

Posted on 2023-01-10 | In 算法 , 思维

题意

我们定义一个01字符串是good当且仅当每个奇数位index的数字是1-index这个子串的中位数(即这个数字是1-index子串中出现最多的数字)。定义extend操作为对于一个01串,在两两数字之间插入0/1.现给定一个01串,问对于所有的前缀,extend后为good的串有多少。

Read more »

CodeForces - 1768D Lucky Permutation

Posted on 2023-01-08 | In 算法 , 思维

题意

给定一个数组,问需要多少次两个元素的交换操作后使得数组中只有一个逆序对

Read more »

Eventbus随笔

Posted on 2022-10-26 | In 工程 , 设计模式

在USC的CSCI-526游戏开发课程中,我们的项目遇到了这样一个问题:对于一个事件,可能有多个模块需要关注。比如游戏中的天气变更事件,防御塔、怪物、数据统计模块都需要根据这个事件触发操作。最开始时我们将触发代码,甚至是部分逻辑放入了其他系统,导致了模块间的强耦合。为了解决这个问题,我想到了观察者模式,又想到了在字节实习时使用的EventBus。于是我便按照记忆手写了属于我们自己的Eventbus,在实现的过程中发现这个模式确实非常有趣,故写文记录。

Read more »

Codeforces Educational Round 135

Posted on 2022-09-10 | In 算法 , CodeForces

Edu round 135 tutorial

Read more »

CodeForces - 1721E Prefix Function Queries(KMP优化)

Posted on 2022-08-30 | In 算法 , 字符串 , kmp

cf中碰到了kmp的一种优化方式,特此记录。

Read more »

CodeForces - 1710B Rain(前缀和+几何)

Posted on 2022-08-14 | In 算法 , 前缀和

比赛中没有想到解法。在浏览其他人代码时,发现许多选手使用了相同的思路,似乎是一种广为人知的解法,特此记录一下。

Read more »

Leetcode - 1776 Car Fleet II

Posted on 2022-07-01 | In 算法 , 凸包

In the discussion of this problem, most people said we can use monostack to solve it. However, they didn’t tell us why. Here I want to give an explanation with more details.

Read more »

Leetcode - 376 Wiggle Subsequence

Posted on 2022-06-18 | In 算法 , 动态规划 , 线性dp

It taked me a long time to understand the solutions in Discussion, so I decided to explain it by myself.

Read more »

Leetcode - 2262 Total Appeal of A String.md

Posted on 2022-06-16 | In 算法 , 动态规划 , 线性dp

A very interesting dp problem.

Read more »
12…10

93 posts
70 categories
61 tags
GitHub E-Mail
Links
  • numberer
© 2023 ManuShi98
Powered by Hexo
|
Theme — NexT.Pisces v5.1.4