04 2023 档案

摘要:砍树 给定一棵由 n 个结点组成的树以及 m 个不重复的无序数对 (a1,b1),(a2,b2),,(am,bm),其中 ai 互不相同,bi 互不相同,aibj (1i,jm)。 小明想知道是否能够选 阅读全文
posted @ 2023-04-29 08:55 onlyblues 阅读(62) 评论(0) 推荐(0) 编辑
摘要:D. Unique Palindromes A palindrome is a string that reads the same backwards as forwards. For example, the string abcba is palindrome, while the strin 阅读全文
posted @ 2023-04-28 19:39 onlyblues 阅读(92) 评论(0) 推荐(2) 编辑
摘要:闇の連鎖 传说中的暗之连锁被人们称为 Dark。 Dark 是人类内心的黑暗的产物,古今中外的勇者们都试图打倒它。 经过研究,你发现 Dark 呈现无向图的结构,图中有 N 个节点和两类边,一类边被称为主要边,而另一类被称为附加边。 Dark 有 N1 条主要边,并且 Dark 的任意两个 阅读全文
posted @ 2023-04-27 22:18 onlyblues 阅读(41) 评论(0) 推荐(0) 编辑
摘要:D. Super-Permutation A permutation is a sequence n integers, where each integer from 1 to n appears exactly once. For example, [1], $[3,5,2,1, 阅读全文
posted @ 2023-04-26 19:38 onlyblues 阅读(140) 评论(0) 推荐(1) 编辑
摘要:F. Gardening Friends Two friends, Alisa and Yuki, planted a tree with n vertices in their garden. A tree is an undirected graph without cycles, loop 阅读全文
posted @ 2023-04-26 16:45 onlyblues 阅读(213) 评论(0) 推荐(0) 编辑
摘要:G2. Magic Triples (Hard Version) This is the hard version of the problem. The only difference is that in this version, ai109. For a given seq 阅读全文
posted @ 2023-04-26 15:57 onlyblues 阅读(72) 评论(0) 推荐(0) 编辑
摘要:最长不下降子序列 给定一个长度为 N 的整数序列:A1,A2,,AN。 现在你有一次机会,将其中连续的 K 个数修改成任意一个相同值。 请你计算如何修改可以使修改后的数列的最长不下降子序列最长,请输出这个最长的长度。 最长不下降子序列是指序列中的一个子序列,子序列中 阅读全文
posted @ 2023-04-25 17:38 onlyblues 阅读(91) 评论(0) 推荐(0) 编辑
摘要:牌堆 有 n 张纸牌,编号 1n。 其中,第 i 张纸牌的价值为 vi。 你要玩一个游戏,具体流程如下: 首先,你要将 n 张牌一张叠一张地堆成一个牌堆,牌堆中纸牌的具体排列顺序由你决定。 接下来,你需要依次进行 m 次操作。 关于第 i 次操作: 你的任务 阅读全文
posted @ 2023-04-23 21:19 onlyblues 阅读(40) 评论(0) 推荐(0) 编辑
摘要:最长公共子串 给定两个字符串,求这两个字符串的不包含数字的最长公共子串的长度。 输入格式 共两行,每行一个由小写字母和数字构成的字符串。 输出格式 一个整数,表示给定两个字符串的不包含数字的最长公共子串的长度。 如果不存在满足要求的非空公共子串,则输出 0。 数据范围 输入字符串的长度均不超过 阅读全文
posted @ 2023-04-20 20:25 onlyblues 阅读(62) 评论(0) 推荐(0) 编辑
摘要:Minimum Number of Visited Cells in a Grid You are given a 0-indexed m x n integer matrix grid . Your initial position is at the top-left cell (0, 0). 阅读全文
posted @ 2023-04-16 21:37 onlyblues 阅读(38) 评论(0) 推荐(0) 编辑
摘要:Minimum Reverse Operations You are given an integer n and an integer p in the range [0, n - 1]. Representing a 0-indexed array arr of length n where a 阅读全文
posted @ 2023-04-15 15:00 onlyblues 阅读(20) 评论(0) 推荐(0) 编辑
摘要:疯狂的馒头 CQF 十分喜欢吃馒头。 兴奋之下他一下子买了 N 个馒头请所有认识他的人吃。 但是 CQF 不喜欢白色,喜欢红色、黄色、绿色等鲜艳的颜色。 于是他把所有白色的馒头排成一列。 然后进行 M 次染色操作。 每个染色操作都是用一个神奇的刷子把连续的多个馒头染成特定的某种颜色。 一个馒 阅读全文
posted @ 2023-04-15 10:00 onlyblues 阅读(97) 评论(0) 推荐(0) 编辑
摘要:Shortest Cycle in a Graph There is a bi-directional graph with n vertices, where each vertex is labeled from 0 to n - 1. The edges in the graph are re 阅读全文
posted @ 2023-04-14 17:52 onlyblues 阅读(25) 评论(0) 推荐(0) 编辑
摘要:无向图的最小环问题 题目描述 给定一张无向图,求图中一个至少包含 3 个点的环,环上的节点不重复,并且环上的边的长度之和最小。该问题称为无向图的最小环问题。在本题中,你需要输出最小的环的边权和。若无解,输出 No solution. 。 输入格式 第一行两个正整数 n,m 表示点数和边数。 阅读全文
posted @ 2023-04-14 17:27 onlyblues 阅读(435) 评论(0) 推荐(0) 编辑
摘要:国际象棋 众所周知,“八皇后” 问题是求解在国际象棋棋盘上摆放 8 个皇后,使得两两之间互不攻击的方案数。 已经学习了很多算法的小蓝觉得 “八皇后” 问题太简单了,意犹未尽。作为一个国际象棋迷,他想研究在 N×M 的棋盘上,摆放 K 个马,使得两两之间互不攻击有多少种摆放方 阅读全文
posted @ 2023-04-05 19:53 onlyblues 阅读(56) 评论(0) 推荐(0) 编辑
摘要:方格迷宫 给定一个 nm 列的方格矩阵。 行从上到下依次编号为 1n,列从左到右依次编号为 1m。 第 i 行第 j 列的方格表示为 (i,j)。 矩阵中的方格要么是空地(用 . 表示),要么是陷阱(用 # 表示)。 初始时,你位于方格 $( 阅读全文
posted @ 2023-04-04 20:04 onlyblues 阅读(79) 评论(0) 推荐(0) 编辑
摘要:砝码称重 给定一个天平和 101 个砝码。 101 个砝码的重量依次为 n0,n1,n2,,n100 克,其中 n 是一个不小于 2 的整数。 请你判断,我们能否利用给定天平和砝码对重量为 m 克的物品进行称重。 注意,天平的两端都可以放入砝码。 阅读全文
posted @ 2023-04-04 16:04 onlyblues 阅读(50) 评论(0) 推荐(0) 编辑
摘要:C. Place for a Selfie The universe is a coordinate plane. There are n space highways, each of which is a straight line y=kx passing through the or 阅读全文
posted @ 2023-04-04 10:14 onlyblues 阅读(112) 评论(0) 推荐(0) 编辑
摘要:D. A Wide, Wide Graph You are given a tree (a connected graph without cycles) with n vertices. Consider a fixed integer k. Then, the graph Gk i 阅读全文
posted @ 2023-04-04 09:38 onlyblues 阅读(98) 评论(0) 推荐(0) 编辑

Web Analytics
点击右上角即可分享
微信分享提示