hard

1851. Minimum Interval to Include Each Query (Hard)

Description 1851. Minimum Interval to Include Each Query (Hard) You are given a 2D integer array intervals, where intervals[i] = [lefti, righti] descr ......
Interval Minimum Include Query 1851

Learning hard C#学习笔记——读书笔记 05

本文介绍了C#编译成IL语言(Intermediate Language)的过程,以及使用ILDasm.exe工具查看IL代码的方法。文章通过一个Hello World程序,在ILDasm.exe工具中展示了MANIFEST清单和IL代码。 ......
笔记 Learning hard 05

[Typescript] 150 Hard - OptionalUndefined

Implement the util type OptionalUndefined<T, Props> that turns all the properties of T that can be undefined, into optional properties. In addition, a ......
OptionalUndefined Typescript Hard 150

Learning hard C#学习笔记——读书笔记 04

## 1.什么是接口 接口可以认为是一种规范,它是一种类的构建规范,它里面定义了一系列的方法和类型,但是没有具体的实现,需要继承它的类去自我实现 ## 2.接口的定义 使用 VS2022 在解决方案管理器这里,添加新建项 在添加新建项模板这里,选择接口 最后创建出来的接口如下 ```C# using ......
笔记 Learning hard 04

834. 树中距离之和 (Hard)

问题描述 834. 树中距离之和 (Hard) 给定一个无向、连通的树。树中有 n 个标记为 0...n-1 的节点以及 n-1 条边 。 给定整数 n 和数组 edges , edges[i] = [aᵢ, bᵢ] 表示树中的节点 aᵢ 和 bᵢ 之间有一条边。 返回长度为 n 的数组 answe ......
中距离 之和 Hard 834

834. Sum of Distances in Tree (Hard)

Description 834. Sum of Distances in Tree (Hard) There is an undirected connected tree with n nodes labeled from 0 to n - 1 and n - 1 edges. You are g ......
Distances Hard Tree 834 Sum

Learning hard C#学习笔记——读书笔记 03

本文介绍了C#面向对象编程语言的三个基础特征:封装、继承和多态。其中,封装可以通过public、private、protected、internal等关键字来实现,目的是保护程序内部数据的完整性;继承可以帮助实现基类的内容复用,但也要结合场景使用;多态是指相同类型对象调用相同方法却表现出不同行为,使... ......
笔记 Learning hard 03

Learning hard C#学习笔记——读书笔记 02

每每说到类,不得不介绍的就是类的定义,它是一个抽象的概念,它是一个模板,制造对象的模板 ## 1.定义一个类 ```C# class Preson { // 类的成员变量 } ``` > 默认情况下,class关键字没有显式的使用`internal`修饰符来定义类,但是没有必要这样做,默认的修饰符就 ......
笔记 Learning hard 02

[论文速览] Hard Patches Mining for Masked Image Modeling

## Pre title: Hard Patches Mining for Masked Image Modeling accepted: CVPR 2023 paper: https://arxiv.org/abs/2304.05919 code: https://github.com/Haoch ......
Modeling Patches Mining Masked 论文

CF1702G2 Passable Paths (hard version)

## 思路 题意:判断是否存在一条链包含树上给定点集。 考虑把 $1$ 当做树的根,将无根树转化为有根树。 考虑这样一个性质:若存在满足条件的最短链,则点集中深度最深的点 $u$ 是该链的一个端点,点集中距离 $u$ 最远的点 $v$ 是该链的另一端点。 >证明:若点 $u$ 不是链的端点,则 $u ......
Passable version 1702G Paths 1702

牛客练习赛113 D 小红的数组操作(hard version)

题目要求求出最小的总代价使得平均数为整数,转换式子可得实际就是求出a,b使得(a*x-b*y+sum)%n==0且a*p+b*q要最小,平均值的为sum/n,因此对sum进行操作使其成为n的倍数即可 (a*x-b*y+sum)%n==0 =>((a*x+sum)%n-b*y%n)%n==0 因为(a ......
练习赛 数组 version hard 113

354. Russian Doll Envelopes (Hard)

Description 354. Russian Doll Envelopes (Hard) You are given a 2D array of integers envelopes where envelopes[i] = [wi, hi] represents the width and t ......
Envelopes Russian Doll Hard 354

354. 俄罗斯套娃信封问题 (Hard)

问题描述 354. 俄罗斯套娃信封问题 (Hard) 给你一个二维整数数组 envelopes ,其中 envelopes[i] = [wᵢ, hᵢ] ,表示第 i 个信封的宽度和高度。 当另一个信封的宽度和高度都比这个信封大的时候,这个信封就可以放进另一个信封里,如同俄罗斯套娃一样。 请计算 最多 ......
信封 问题 Hard 354

741. 摘樱桃 (Hard)

问题描述 741. 摘樱桃 (Hard) 给你一个 n x n 的网格 grid ,代表一块樱桃地,每个格子由以下三种数字的一种来表示: 0 表示这个格子是空的,所以你可以穿过它。 1 表示这个格子里装着一个樱桃,你可以摘到樱桃然后穿过它。 -1 表示这个格子里有荆棘,挡着你的路。 请你统计并返回: ......
樱桃 Hard 741

741. Cherry Pickup (Hard)

Description 741. Cherry Pickup (Hard) You are given an n x n grid representing a field of cherries, each cell is one of three possible integers. 0 mea ......
Cherry Pickup Hard 741

Codeforces Round 881 (Div. 3) F2. Omsk Metro (hard version) (线段树 )

[传送门](https://codeforces.com/contest/1843/problem/F2) 大致题意: ** 动态给定一颗树,树上每个结点的权值一定为1或者-1。最开始有1号点,权值为1。** ** 输入n表示有n个操作,当第一个符号为+ a b表示添加结点操作,编号依次递增。a表示 ......
线段 Codeforces version Round Metro

1595. 连通两组点的最小成本 (Hard)

问题描述 1595. 连通两组点的最小成本 (Hard) 给你两组点,其中第一组中有 size₁ 个点,第二组中有 size₂ 个点,且 size₁ >= size₂ 。 任意两点间的连接成本 cost 由大小为 size₁ x size₂ 矩阵给出,其中 cost[i][j] 是第一组中的点 i ......
成本 1595 Hard

1595. Minimum Cost to Connect Two Groups of Points] (Hard)

Description 1595. Minimum Cost to Connect Two Groups of Points (Hard) You are given two groups of points where the first group has size1 points, the s ......
Minimum Connect Groups Points 1595

CF958C3. Encryption (hard)

谁说 $n\le5\times 10^5$,$k\le100$,$p\le100$ 只能 $O(nk)$?我今天就要用 $O(nk\log p)$ 过这个题! 定义 $f_{i,j}$ 表示前 $j$ 个数,分成 $i$ 段的最小价值和,$s_i$ 表示前缀和(对 $p$ 取模),转移就是 $f_{ ......
Encryption hard 958 CF C3

1494. 并行课程 II (Hard)

问题描述 1494. 并行课程 II (Hard) 给你一个整数 n 表示某所大学里课程的数目,编号为 1 到 n ,数组 relations 中, relations[i] = [xᵢ, yᵢ] 表示一个先修课的关系,也就是课程 xᵢ 必须在课程 yᵢ 之前上。同时你还有一个整数 k 。 在一个学 ......
课程 1494 Hard II

1494. Parallel Courses II (Hard)

Description 1494. Parallel Courses II (Hard) You are given an integer n, which indicates that there are n courses labeled from 1 to n. You are also gi ......
Parallel Courses 1494 Hard II

552.Student Attendance Record II (Hard)

Description 552. Student Attendance Record II (Hard) An attendance record for a student can be represented as a string where each character signifies ......
Attendance Student Record Hard 552

1483. Kth Ancestor of a Tree Node (Hard)

Description 1483. Kth Ancestor of a Tree Node (Hard) You are given a tree with n nodes numbered from 0 to n - 1 in the form of a parent array parent w ......
Ancestor 1483 Hard Tree Node

[ABC162E] Sum of gcd of Tuples (Hard)

## 题面翻译 给定$n,k$,求 $$\sum^k_{a_1=1}\sum^k_{a_2=1}\sum^k_{a_3=1}\dots\sum^k_{a_n=1}gcd(a_1,a_2,a_3,\dots,a_n)\ mod\ 1000000007$$ ### 制約 - $ 2\ \leq\ N\ ......
Tuples 162E Hard of ABC

2681. 英雄的力量 (Hard)

问题描述 2681. 英雄的力量 (Hard) 给你一个下标从 0 开始的整数数组 nums ,它表示英雄的能 力值。如果我们选出一部分英雄,这组英雄的 力量 定义为: i₀ , i₁ ,... iₖ 表示这组英雄在数组中的下标。那么这组英雄的力量为 max(nums[i₀],nums[i₁] .. ......
力量 英雄 2681 Hard

297.二叉树的序列化与反序列化 (Hard)

问题描述 297. 二叉树的序列化与反序列化 (Hard) 序列化是将一个数据结构或者对象转换为连续的比特位的操作,进而可以将转换后的数据存储在一个文件或者内存中,同时也可以通过网络传输到另一个计算机环境,采取相反方式重构得到原数据。 请设计一个算法来实现二叉树的序列化与反序列化。这里不限定你的序列 ......
序列 Hard 297

84. 柱状图中最大的矩形 (Hard)

问题描述 84. 柱状图中最大的矩形 (Hard) 给定 n 个非负整数,用来表示柱状图中各个柱子的高度。每个柱子 彼此相邻,且宽度为 1 。 求在该柱状图中,能够勾勒出来的矩形的最大面积。 示例 1: ![](https://assets.leetcode.com/uploads/2021/01/ ......
矩形 Hard 84

41.缺失的第一个正数 (Hard)

问题描述 41. 缺失的第一个正数 (Hard) 给你一个未排序的整数数组 nums ,请你找出其中没有出现的最小的正整数。 请你实现时间复杂度为 O(n) 并且只使用常数级别额外空间的解决方案。 示例 1: 输入:nums = [1,2,0] 输出:3 示例 2: 输入:nums = [3,4,- ......
正数 缺失 Hard 41

2646. 最小化旅行的价格总和 (Hard)

问题描述 2646. 最小化旅行的价格总和 (Hard) 现有一棵无向、无根的树,树中有 n 个节点,按从 0 到 n - 1 编号。给你一个整数 n 和一个长度为 n - 1 的二维整数数 组 edges ,其中 edges[i] = [aᵢ, bᵢ] 表示树中节点 aᵢ 和 bᵢ 之间存在一条边 ......
总和 价格 2646 Hard

85. 最大矩形 (Hard)

问题描述 85. 最大矩形 (Hard) 给定一个仅包含 0 和 1 、大小为 rows x cols 的二维二进 制矩阵,找出只包含 1 的最大矩形,并返回其面积。 示例 1: ![](https://assets.leetcode.com/uploads/2020/09/14/maximal.j ......
矩形 Hard 85