随笔分类 -  luogu

摘要:Come Together time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Bob and Carol hanged out w 阅读全文
posted @ 2023-07-12 15:50 o-Sakurajimamai-o 阅读(33) 评论(0) 推荐(0) 编辑
摘要:Strong Password time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Monocarp finally got the 阅读全文
posted @ 2023-07-12 15:46 o-Sakurajimamai-o 阅读(65) 评论(0) 推荐(0) 编辑
摘要:Apple Tree time limit per test 4 seconds memory limit per test 512 megabytes input standard input output standard output Timofey has an apple tree gro 阅读全文
posted @ 2023-07-11 15:40 o-Sakurajimamai-o 阅读(44) 评论(0) 推荐(0) 编辑
摘要:Sum in Binary Tree time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vanya really likes mat 阅读全文
posted @ 2023-07-11 15:39 o-Sakurajimamai-o 阅读(60) 评论(0) 推荐(0) 编辑
摘要:Long Long 题面翻译 题目描述给出一个包含 $n$ 个数字的数列 $a$。你可以执行任意次操作,每次操作可以更改 [l, r] 范围内的正负性(正数变负,负数变正,0 不变)。你要使得数列每个元素之和尽量大,问最小的操作次数。 多组询问。 输入格式第一行一个整数 $T$,表示询问组数。 每一 阅读全文
posted @ 2023-07-11 15:36 o-Sakurajimamai-o 阅读(34) 评论(0) 推荐(0) 编辑
摘要:Lamps 题面翻译 有 $n$ 盏灯,每盏灯有不亮,亮,坏掉 3 种状态。一开始每盏灯都不亮。 第 $i$ 盏灯有属性 $a_i,b_i$。每次操作你可以选择一盏灭的灯将其点亮,并得到 $b_i$ 的分数。 每次操作结束后,记有 $x$ 盏灯亮着,则所有 $a_i \le x$ 的灯 $i$ 都会 阅读全文
posted @ 2023-07-10 18:23 o-Sakurajimamai-o 阅读(86) 评论(0) 推荐(0) 编辑
摘要:# Contrast Value ## 题面翻译 定义序列 $a_1,a_2,\dots,a_n$ 的权值是$|a_1-a_2|+|a_2-a_3|+\dots+|a_{n-1}-a_n|$。 $T$ 次询问,每次给一个序列 $a$ ,一个 $a$ 的子序列 $b$ 合法当且仅当 $b$ 权值和 $ 阅读全文
posted @ 2023-07-10 18:16 o-Sakurajimamai-o 阅读(22) 评论(0) 推荐(0) 编辑
摘要:Maximum Sum time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given an array a1,a2 阅读全文
posted @ 2023-07-10 18:15 o-Sakurajimamai-o 阅读(23) 评论(0) 推荐(0) 编辑
摘要:Forever Winter time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output A snowflake graph is gene 阅读全文
posted @ 2023-06-30 19:32 o-Sakurajimamai-o 阅读(35) 评论(0) 推荐(0) 编辑
摘要:Constructive Problem time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output As you know, any pro 阅读全文
posted @ 2023-06-30 19:29 o-Sakurajimamai-o 阅读(26) 评论(0) 推荐(0) 编辑
摘要:Cake Assembly Line time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output A cake assembly line i 阅读全文
posted @ 2023-06-29 11:54 o-Sakurajimamai-o 阅读(19) 评论(0) 推荐(0) 编辑
摘要:Dolce Vita time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Turbulent times are coming, s 阅读全文
posted @ 2023-06-29 10:21 o-Sakurajimamai-o 阅读(10) 评论(0) 推荐(0) 编辑
摘要:Scoring Subsequences time limit per test 2.5 seconds memory limit per test 256 megabytes input standard input output standard output The score of a se 阅读全文
posted @ 2023-06-24 09:39 o-Sakurajimamai-o 阅读(25) 评论(0) 推荐(0) 编辑
摘要:用nsqrt(n)的时间复杂度就能过 //Dreaming of Freedom:https://codeforces.com/problemset/problem/1826/C #include <bits/stdc++.h> //#define int long long using names 阅读全文
posted @ 2023-06-23 10:25 o-Sakurajimamai-o 阅读(40) 评论(0) 推荐(0) 编辑
摘要:比普通幂运算更快,只需要预处理一些数就可以 普通幂: 1 int res=1; 2 for(int i=0;i<k;i++) 3 res=res*n; 4 return res; 快速幂: //快速幂:https://www.luogu.com.cn/problem/P1226 #include < 阅读全文
posted @ 2023-06-21 14:25 o-Sakurajimamai-o 阅读(9) 评论(0) 推荐(0) 编辑
摘要:Getting Zero time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Suppose you have an integer 阅读全文
posted @ 2023-06-21 13:05 o-Sakurajimamai-o 阅读(12) 评论(0) 推荐(0) 编辑
摘要://[POI2006] OKR-Periods of Words:https://www.luogu.com.cn/problem/P3435 //题意就是求每个子串的最小公共前后缀,也就是让我们的next数组缩到最小就可以 //这里要记忆化一下,枚举到i的时候可以直接跳到j,减少枚举次数 #inc 阅读全文
posted @ 2023-06-21 10:58 o-Sakurajimamai-o 阅读(7) 评论(0) 推荐(0) 编辑
摘要:思路:找规律情况一: 尾数为5或0 为5时进行一次操作变成0的情况。而尾数是 0 时操作无意义,所有数必须相等。情况二:尾数为 1,3,7,9可进行一次操作变成情况三。情况三:尾数为 2,4,6,8我们通过找规律发现: 2⇒4⇒8⇒16⇒22 4⇒8⇒16⇒22⇒24 6⇒12⇒14⇒18⇒26 8 阅读全文
posted @ 2023-06-20 11:47 o-Sakurajimamai-o 阅读(38) 评论(0) 推荐(0) 编辑
摘要:kmp算法用于优化字符串匹配效率: //KMP字符串匹配: //模板: #include<bits/stdc++.h> using namespace std; const int N=1e6+10; char s1[N],s2[N]; int ne[N],n,res; int main() { s 阅读全文
posted @ 2023-06-18 20:34 o-Sakurajimamai-o 阅读(20) 评论(0) 推荐(0) 编辑
摘要:【题面】 你决定用素数定理来做一个调查. 众所周知, 素数又被称为质数,其含义就是除了数字一和本身之外不能被其他任何的数字除尽. 现在给定一个正整数序列 ,+1,⋯ ,a,a+1,⋯,b (≤)(a≤b), 请找出一个最小值 l, 使其满足对于任意一个长度为 l 的子串, 都包含 k 个质数. 找到 阅读全文
posted @ 2023-06-18 10:17 o-Sakurajimamai-o 阅读(19) 评论(0) 推荐(0) 编辑

-- --