111
111
原创 2018-01-07 14:57:06
457阅读
1 import collections 2 class Solution: 3 def relativeSortArray(self, arr1: 'List[int]', arr2: 'List[int]') -> 'List[int]': 4 n1 = len(arr1) 5 n2 = len(arr2) 6 if
转载 2019-07-14 11:20:00
29阅读
时间限制: 1000 ms ...
转载 2019-03-14 19:29:00
106阅读
2评论
时间限制: 1000 ms ...
转载 2019-03-14 19:29:00
107阅读
2评论
时间限制: 1000 ms ...
转载 2019-03-14 19:29:00
206阅读
2评论
1122. Hamiltonian Cycle (25)时间限制300 ms内存限制65536 kB代码长度限
原创 2022-08-30 10:11:49
63阅读
题目题意:给一个无向图,然后查询k个环,
原创 2023-06-27 10:21:46
59阅读
最大子树和 1.题目大意: 给出一棵树,求点权和最大的连通分量。 2.解题思路: 很显然是基础的树上DP问题。 跑dfs时套方程就好了。 3.方程: 我们用dp[i]表示以i为根的子树中点权和最大的一棵子树,用a[i]表示点权。 dp[i]有两个选择:1.不剪断子树2.剪断子树。 如果u是当前点,v ...
转载 2021-10-04 12:54:00
88阅读
2评论
​​https://www.rfc-editor.org/rfc/rfc1122.html​​
原创 2022-04-15 10:39:07
506阅读
The "Hamilton cycle problem" is to find a simple cycle that contains every vertex in a graph. Such a cycle is called a "Hamiltonian cycle". In this pr
转载 2020-04-23 17:13:00
91阅读
时间限制: 1000 ms 内存限制: 65536 KB提交数: 7273 通过数: 4221【题目描述】给定一个5*5的矩阵,每行只有一个最大值,每列只有一个最小值,寻找这个矩阵的鞍点。鞍点指的是矩阵中的一个元素,它是所在行的最大值,并且是所在列的最小值。例如:在下面的例子中(第4行第1列的元素就是鞍点,值为8 )。11 3 5 6 912 4 7 8 10...
原创 2021-08-10 09:53:04
238阅读
时间限制: 1000 ms 内存限制: 65536 KB 提交数: 7273 通过数: 4221 【题目描述】给定一个5*5的矩阵,每行只有一个最大值,每列只有一个最小值,寻找这个矩阵的鞍点。 鞍点指的是矩阵中的一个元素,它是所在行的最大值,并且是所在列的最小值。例如:在下面的例子中(第4行第1列的元素就是鞍点,值为8 )。11 3 5 6 912 4 7 8 1010 5 6 9 118 6 4
原创 2022-03-24 10:55:01
344阅读
ClockTime Limit:2 Seconds Memory Limit:65536 KBYou are given a standard 12-hour clock with analog display, an hour hand and a minute hand. How many times does the minute hand pass the hour hand in a given time interval?Sample Input12 50 1 2 3 8 3 20 2 45 11 011 0 3 20 1 2 12 50 3 20 3 8Sam...
转载 2014-03-12 23:19:00
65阅读
2评论
简化问题:如果没有2操作,答案是多少贪心:修改-一定修改最前面的,修改+一定修改最后面的,正确性显然而通过1操作,要完成两步:1.让最终结果为q;2.让前缀和非负,通过贪心可以获得最小值(具体来说,假设初始有nq个+,np个-,第一步操作后前缀最小值为k,那么答案为$(|p+nq-np-q|/2+\
DescriptionGiven a set of digits S, and an integer n, you have to find how many n-digit
原创 2016-04-09 15:27:30
68阅读
1122 Hamiltonian Cycle (25 point(s))The "Hamilton cycle problem" is to find a simp
原创 2022-09-15 10:59:32
48阅读
Millionaire Rank ListTime Limit: 1000msMemory Limit: 131072kbDescriptionIn the wild universe, there lives a race of clever creature. They have high level civilization and control a lot of planet
原创 2021-08-20 14:49:18
53阅读
1122. Relative Sort Array*https://leetcode.com/problems/relative-sort-array/题目描述Given two arrays arr1 and arr2, the elements of arr2 are distinct, and all elements in arr2 are also in arr1.Sort th...
原创 2022-05-30 11:22:35
60阅读
水~。 题意 给定一个无向图和一.堆路径,判断每一条路径是否是这个无向图的哈密顿回路。所谓哈密顿回路是指首尾结点相同、经过且恰好经过图上所有结点各一次的路径。 思路 根据哈密顿回路的定义,一条路径是哈密顿回路需要满足3个条件: (1)首尾结点相同。 (2)路径的每条边必须都存在。 (3)不考虑首结点
转载 2021-03-02 11:45:00
99阅读
  • 1
  • 2
  • 3
  • 4
  • 5