divisors two

CF762C Two strings 题解

洛谷传送门 CF 传送门 题意 给你两个字符串 \(a\) 和 \(b\),你可以在 \(b\) 中删去尽量短的子段,使得 \(b\) 是 \(a\) 的子序列。求出最后的 \(b\)。 思路 真是奇了怪了,这种题洛谷题解里竟然没有双指针的做法? 首先考虑判断一个字符串 \(b\) 是否是另一个字符 ......
题解 strings 762C 762 Two

E. Split Into Two Sets 建模 + 染色法判奇环

题意 给定$n$ $(2 \leq n \leq 2∗10^5)$个骨牌,第 $n$个骨牌上有 $a_i, b_i$ $(1 \leq {a_i, b_i} \leq n)$ 两个数字。 现在你需要把骨牌分成两堆,使得每一个堆里面都没有重复的数字。问是否可以实现. 题解 首先排除一些情况,一张牌上的 ......
染色法 Split Into Sets Two

CF1864C Divisor Chain

原题 翻译 好题难想 首先考虑\(x = 2^k\)怎么做,显然每次\(- 2^{k-1}\)即可 然后我们考虑对于\(x \neq 2^k\)怎么把他变成\(2^k\),答案就是\(x -= lowbit(x)\) 操作次数\(O(logn)\)的,\(< 1000\),正确性显然 ......
Divisor 1864C Chain 1864 CF

Implementing Domain Driven Design (Part Two)

# Implementation: The Building Blocks This is the essential part of this guide. We will introduce and explain some **explicit rules** with examples. Y ......
Implementing Domain Design Driven Part

* Codeforces Round 889 (Div. 2) B. Longest Divisors Interval

给一个正整数 $n$ ,找一段最长的 $[l, r]$ ,满足 $\forall i, i \in [l, r],\ s.t.\ i | n$ 。输出这一段区间的长度,即 $r - l + 1$ 。 这题是一个准结论题,需要一些知识点和观察的基础。 放在 $900$ 的位置是因为结论存在的区间太容易 ......
Codeforces Divisors Interval Longest Round

力扣——9 [回文数](https://leetcode.cn/problems/two-sum/)

给你一个整数 `x` ,如果 `x` 是一个回文整数,返回 `true` ;否则,返回 `false` 。 回文数是指正序(从左向右)和倒序(从右向左)读都是一样的整数。 - 例如,`121` 是回文,而 `123` 不是。 **示例 1:** ``` 输入:x = 121 输出:true ``` ......
回文 leetcode problems two-sum https

[CF1641D] Two Arrays

## 题目描述 Sam changed his school and on the first biology lesson he got a very interesting task about genes. You are given $ n $ arrays, the $ i $ -th o ......
Arrays 1641D 1641 Two CF

力扣——1 [两数之和](https://leetcode.cn/problems/two-sum/)

给定一个整数数组 `nums` 和一个整数目标值 `target`,请你在该数组中找出 **和为目标值** *`target`* 的那 **两个** 整数,并返回它们的数组下标。 你可以假设每种输入只会对应一个答案。但是,数组中同一个元素在答案里不能重复出现。 你可以按任意顺序返回答案。 **示例 ......
之和 leetcode problems two-sum https

CF1861B Two Binary Strings

## 思路 ~~最近熬夜打 CF,视力下降了。没看到题目里给了第一位和最后一位必定是 $0$ 和 $1$,导致想了半天。~~ 考虑枚举字符串的位置 $i$。 首先如果遇到了两个串第 $i$ 位都是 $1$,那么可以直接覆盖中间的片段,一定能成功。 如果遇到不同的位置,考虑找到最近的 $0$ 与第一位 ......
Strings Binary 1861B 1861 Two

CF1863D Two-Colored Dominoes

## 思路 首先考虑保证每行的黑白数量一样,横着的一定是贡献一黑一白,所以只用考虑竖着的,同理竖着的任何方案也不会影响横着的要求。 因为两个同行的竖着的颜色可以互换,所以在满足条件的情况下,谁黑谁白无所谓。 考虑从上往下满足,因为 ```D``` 的格子已经在上一行中确定了,所以可以在上一行时就先把 ......
Two-Colored Dominoes Colored 1863D 1863

CF1864C Divisor Chain 题解

## 题意 给定一个整数 $x$,定义一个操作: > 选择一个 $x$ 的因数 $d$,把 $x$ 修改为 $x-d$。 限制相同的 $d$ 值不能选择超过 $2$ 次,需要在最多 $1000$ 次操作内把 $x$ 操作至 $1$,求操作序列。 ($1 \le x \le 10^9$)。 ## 题解 ......
题解 Divisor 1864C Chain 1864

CF1864C Divisor Chain

## 思路 刚拿到题,想了一些方法但都被推翻了,在这里列举出来,并给出反例: - 每次减去最小的因数,反例:$1024$ 等形如 $a^k$ 的数,每次都会减去 $a$ 导致 $a$ 的出现次数超过 $2$ 次。 - 每次减去大于等于 $\sqrt x$ 的因子,$x$ 为目前的数,并特判指数的情况 ......
Divisor 1864C Chain 1864 CF

Data structure and algorithm-Two

B树 扩容 找出不含重复字符的最长字串的长度 字母异位词分组 优化用一个长度26的整数数组来标识 ArrayKey的构造方法 判断是否存在重复元素 借鉴HashSet后的小优化版 put 自带一个返回值,返回的是添加前原位置的元素,若原位置为空,则返回null 添加,若遇到重复元素,则在集合中删除, ......
algorithm-Two structure algorithm Data and

【1165D】Almost All Divisors(数论)

**题目大意:** 给出一个数的所有因数(除了$1$和这个数本身),判断这个数是否存在。 *** 先将所有因数排序,然后计算最小因数和最大因数的积,我们设这个数为$x$。 如果$x$满足了以下的任意一个条件,则答案为不存在: 1. 存在一个$k$,第$k$大的数和第$k$小的数之积不等于$x$。 2 ......
数论 Divisors Almost 1165D 1165

论文解读(TAMEPT)《A Two-Stage Framework with Self-Supervised Distillation For Cross-Domain Text Classification》

论文信息 论文标题:A Two-Stage Framework with Self-Supervised Distillation For Cross-Domain Text Classification论文作者:Yunlong Feng, Bohan Li, Libo Qin, Xiao Xu, ......

001_two_sum

准备工作 安装vscode(并安装其leetcode插件)、nodejs环境。 问题描述 给定一个整数数组 nums 和一个整数目标值 target,请你在该数组中找出 和为目标值 target 的那 两个 整数,并返回它们的数组下标。 你可以假设每种输入只会对应一个答案。但是,数组中同一个元素在答 ......
two_sum 001 two sum

Two Centroids

## Two Centroids 先考虑对于一棵树,至少要加多少个点才能有两个重心。 以重心为根,设最大儿子的子树大小为 $mx$,那么答案就为 $(n - mx) - mx = n - 2mx$。 接下来考虑如何在加点时维护最大子树,一个显然的性质,加一个点重心最多偏移一位,如果重心偏移,那么 $ ......
Centroids Two

Leetcode 1. 两数之和(Two sum)

[题目链接🔗](https://leetcode.cn/problems/two-sum) 给定一个整数数组 nums 和一个整数目标值 target,请你在该数组中找出 和为目标值 target 的那 两个 整数,并返回它们的数组下标。 你可以假设每种输入只会对应一个答案。但是,数组中同一个元素 ......
之和 Leetcode Two sum

L. Two Buildings[分治]

Problem - L - Codeforces 这个分治不好想,看的这篇题解 首先我们把(a[j]+a[i])*(j-i)转换成(a[j]-b[i])*(j-i) //b[i]=-a[i] 那么此时就变成了左下点b和右上点a求矩形的最大面积 下面是两个性质 1.如果i<j同时a[i]<a[j],那 ......
Buildings Two

Leetcode 349.两个数组的交集(Intersection of two arrays)

[题目链接🔗](https://leetcode.cn/problems/intersection-of-two-arrays) 给定两个数组 nums1和 nums2 ,返回 它们的交集 。输出结果中的每个元素一定是 唯一 的。我们可以 不考虑输出结果的顺序 。 示例 1: ``` 输入:num ......
数组 交集 Intersection Leetcode 两个

C# 判断两个时间区间是否交叉重叠 (Determine Whether Two Date Ranges Overlap)

给定两个日期间隔`A`和`B`,组件`.start`和`.end`和约束`.start = B.start AND A.start =与>和 B.StartDate && A.StartDate < B.EndDate) { //range is conflict } ``` 引用:https:// ......
区间 Determine 两个 Whether Overlap

论文解读(BSFDA)《Black-box Source-free Domain Adaptation via Two-stage Knowledge Distillation》

Note:[ wechat:Y466551 | 可加勿骚扰,付费咨询 ] 论文信息 论文标题:Black-box Source-free Domain Adaptation via Two-stage Knowledge Distillation论文作者:Shuai Wang, Daoan Zhan ......

Leetcode 160. 链表相交(Intersection of two linked lists lcci)

[题目链接](https://leetcode.cn/problems/intersection-of-two-linked-lists-lcci/description) 给定两个单链表的头节点headA和headB, 请找出并返回两个单链表相交的起始节点. 如果两个链表没有交点, 返回null. ......
Intersection Leetcode linked lists lcci

【leetcode】1.two sum

第一题给我干懵了...想达到这个要求把我脑壳都想痛了...Follow-up: Can you come up with an algorithm that is less than O(n2) time complexity? 一开始想过用map,但是不能解决重复key的问题。 然而我用sort, ......
leetcode two sum

How to compare two linked lists are equal in Python All In One

How to compare two linked lists are equal in Python All In One 在 Python 中如何比较两个链表是否相等 ......
compare Python linked equal lists

B. Longest Divisors Interval

[link](https://codeforces.com/contest/1855/problem/B) 需要思考一下 如果这个题能做,那么肯定有一种比较可行的做法。 如果$[l,r]$是可行的,那么就意味着$[1,r-l+1]$是可行的 这是显然的,显然后者的每一个数在前者中必然有对应的倍数,所 ......
Divisors Interval Longest

[ABC142D] Disjoint Set of Common Divisors

首先我们知道,若一个数是另外两个数的公共因数,那么它肯定能整除另外两个数的最大公约数。 所以我们可以**枚举最大公约数的质因数**,再把这个质因数在最大公约数中除完,并且答案加一。 注意,要用 `long long` 不然 `int` 溢出之后还在循环,就会导致超时。 ```cpp #include ......
Disjoint Divisors Common 142D ABC

Codeforces 1855B:Longest Divisors Interval 最长的连续约数区间

# [1855B.Longest Divisors Interval](https://codeforces.com/contest/1855/problem/B "Codeforces 1855B") ## Description: - 对于一个整数 $n$ $(1\leq n \leq 10^{ ......
约数 区间 Codeforces Divisors Interval

[Algorithm] Compare two Binary tree are the same in both value and shape

export default function compare( a: BinaryNode<number> | null, b: BinaryNode<number> | null, ): boolean { if (a null && b null) { return true; } if (a ......
Algorithm Compare Binary shape value

[LeetCode] 712. Minimum ASCII Delete Sum for Two Strings

Given two strings s1 and s2, return the lowest ASCII sum of deleted characters to make two strings equal. Example 1: Input: s1 = "sea", s2 = "eat" Out ......
LeetCode Minimum Strings Delete ASCII