自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(58)
  • 收藏
  • 关注

原创 C. Stable Groups

time limit per test1 second memory limit per test256 megabytesinputstandard input outputstandard output There are n studentsnumerated from 1 to n. The level of the i-th student is ai. You needto split the students into stable groups. A group of student.

2021-06-21 11:58:47 283

原创 B. Love Song

B. Love Song time limit per test2 seconds memory limit per test256megabytes inputstandard input outputstandard output Petya once wrote asad love song and shared it to Vasya. The song is a string consistingof lowercase English letters. Vasya made up q q.

2021-06-21 11:57:05 408

原创 Sifid and Strange Subsequences

B. Sifid and Strange Subsequences time limit per test1 second memorylimit per test256 megabytes inputstandard input outputstandard outputA sequence (b1,b2,…,bk) is called strange, if the absolute differencebetween any pair of its elements is greater th.

2021-05-25 12:01:14 130

原创 Cook Pancakes!

链接:https://ac.nowcoder.com/acm/contest/13324/M 来源:牛客网In China, there is a very famous problem about pancakes: You have apan and you can fry two pancakes at the same time each time. For apancake, its front and back sides need to be cooked, and it takes .

2021-03-21 21:33:34 221

原创 普通平衡树

Treap#include <iostream>#include<cstdio>#include <queue>#include <stack>using namespace std;const int maxn=1e5+50;int fa[maxn];int ch[maxn][2];int dat[maxn];int sz[maxn];int rep[maxn];int val[maxn];stack<int> ava;

2021-01-16 14:49:19 71

原创 (1)下周的计划

本周的主要任务-------------------------------- 数据结构* 20。【】本周的辅助任务-----------学完JAVA并写一个工程来巩固。【】----------------------------------------------------暂停前端的学习。【】----------------------------英语试卷2或笔记10或单词*1000。【】...

2020-10-25 22:36:34 76

原创 10.24java作业

java 和 c++有很多重复的地方,感觉比较方便15.n个数组在数组a中,将数据从小到大排列,插入x使数据依旧从小到大排列。package ttt;import java.util.Scanner;public class rr { public static int num=10; public static void printA(double []arr) { for(double i:arr) System.out.print(i+" "); Syste

2020-10-25 14:40:03 220

原创 javascript实现简单数字时钟

javascript初学计时器---简单数字时钟制作Date 对象属性 <script> window.onload = function () { var t2 = document.getElementsByClassName('time2'); var er = t2[0].getElementsByTagName('div'); var t1 = document.getElementsByCl

2020-10-21 22:54:19 697

原创 P1043 数字游戏

传送门本题有两个坑点,一个是数字溢出,一个是负数的取模。除此之外这题做法几乎与P1018一毛一样。#include<iostream>#include<cstring>using namespace std;#define ll long long#define MAX 0x3f3f3f3fll dp1[101][101];ll dp2[101][101];ll vos[101];int main(){ ll m,n; cin>>m

2020-10-18 15:32:43 73

原创 P1018乘积最大

传送门高精度懒得写,用了万能的python。m,n=map(int,input().split())s=int('*'+input())f=[[0 for i in range(m+1)] for j in range(n+1)]for i in range(1,m+1):是左闭右开 f[0][i]=int(str(s)[1:i+1])for i in range(1,m+1):#枚举后缀 for j in range(0,i):#枚举前缀 for k in r

2020-10-17 23:09:27 92

原创 1004方格取数

传送门i 步数 j第1条路径上的横坐标 k第2条路径上的横坐标 (i,i-j) (i,i-k) 代表坐标,存在四种可能1.两个路径点都向下移动 前一步状态为 j,k2.一个路径点向下移动一个向右移动(1) 前一步状态为j-1 k(2) 前一步状态为j,k-13.都向右移动 前一步状态为j-1,k-1DP#include<iostream>#include<cstdio>#include<cstring>using namespace

2020-10-17 21:37:40 72

原创 Dropping tests

01分数规划传送门ai/bi=k f()=ai-kbi 若k增大 f()减少 若k减少f()增大二分查找#include<iostream>#include<cstdio>#include<algorithm>#include<functional>using namespace std;#define in(x) scanf("%d",&x)#define onword(n,arr) \for(int i=0;i<

2020-10-16 17:17:41 116

原创 数据结构笔记

将一组数中的奇数和偶数分别储存在数组两侧。1.建立另外两个数组,分别存储奇数和偶数,然后存储到原数组。空间复杂度O(3n) 时间复杂度O(2n).2.双指针法设置头结点和尾节点,分别遍历偶奇数,不符合则交换位置,直到头结点位置大于等于尾节点。时间复杂度O(n),空间复杂度O(n)。#include<iostream>#include<cstdlib>#include<algorithm>#include<ctime>using namespace

2020-09-29 21:24:39 866

原创 2020-09-15

A. Buying Torchestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are playing a very popular game called Cubecraft. Initially, you have one stick and want to craft k torches. One torch can be cra

2020-09-15 19:43:24 122

原创 记一个TIMELIMITEED

在写广搜时,不经意的将 return x>=0&&x<=r&&y>=0&&y<=c;视为一个判断实际上是四个判断。然后就是因为它我TM了,处理方法是将它化为一个判断,将条件预处理一下时间复杂度大约减少一半?...

2020-09-14 12:06:42 64

原创 2020-09-13

今天卡题卡在了一个奇怪的地方,字符数组和整型数组同时输入一组数,经过类似比较大小的操作,我的编译器下两者结果相同,但是信息奥赛判字符数组WR,WR了一下午才发现这一点,可能是编译器不是一个版本吧,这也太坑了。...

2020-09-13 22:30:41 49

原创 2020-08-20

优先级相同的选择器 并列 相同的属性按照定义属性值的先后顺序,选择最后定义的,前面的相当于被覆盖了。

2020-08-20 20:12:48 64

原创 1591:数字计数

【题目描述】原题来自:ZJOI 2010给定两个正整数 a 和 b,求在 [a,b] 中的所有整数中,每个数码 (digit) 各出现了多少次。【输入】仅包含一行两个整数 a,b,含义如上所述。【输出】包含一行 10 个整数,分别表示 0∼9 在 [a,b] 中出现了多少次。【输入样例】1 99【输出样例】9 20 20 20 20 20 20 20 20 20【提示】数据范围与提示:30% 的数据中,1≤a≤b≤106 ;%100% 的数据中,1≤a≤b≤1012 。#inc

2020-08-18 00:22:06 342

原创 一个小错误

在用visual studio写css伪类:hover时,鼠标经过标记的元素时没有变化或只是部分变了,最后发现选择器+:+hover之间都不能有空格,我看了半天,这也太坑了。

2020-08-12 17:55:27 118

原创 Codeforces Round #661 (Div. 3)

A. Remove Smallesttime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given the array a consisting of n positive (greater than zero) integers.In one move, you can choose two indices i and j (i≠

2020-08-07 16:22:15 554

原创 A. Remove Smallest

You are given the array a consisting of n positive (greater than zero) integers.In one move, you can choose two indices i and j (i≠j) such that the absolute difference between ai and aj is no more than one (|ai−aj|≤1) and remove the smallest of these two

2020-08-06 01:12:12 203

原创 P3373 【模板】线段树 2

链接题目描述如题,已知一个数列,你需要进行下面三种操作:将某区间每一个数乘上 xx将某区间每一个数加上 xx求出某区间每一个数的和输入格式第一行包含三个整数 n,m,pn,m,p,分别表示该数列数字的个数、操作的总个数和模数。第二行包含 nn 个用空格分隔的整数,其中第 ii 个数字表示数列第 ii 项的初始值。接下来 mm 行每行包含若干个整数,表示一个操作,具体如下:操作 11: 格式:1 x y k 含义:将区间 [x,y][x,y] 内每个数乘上 kk操作 22: 格式:2

2020-08-03 12:48:11 131

原创 P3372 【模板】线段树 1

题目描述如题,已知一个数列,你需要进行下面两种操作:将某区间每一个数加上 kk。求出某区间每一个数的和。输入格式第一行包含两个整数 n, mn,m,分别表示该数列数字的个数和操作的总个数。第二行包含 nn 个用空格分隔的整数,其中第 ii 个数字表示数列第 ii 项的初始值。接下来 mm 行每行包含 33 或 44 个整数,表示一个操作,具体如下:1 x y k:将区间 [x, y][x,y] 内每个数加上 kk。2 x y:输出区间 [x, y][x,y] 内每个数的和。输出格式输出

2020-08-02 21:58:10 66

原创 RMQ算法笔记

利用递推思想,min(L,L+2^ n-1)=min(min(L,L+2^(n-1)-1),min(L+2 ^(n-1),L+2 ^n-1))f[i][j]=min(f[i][j-1],f[i+(1<<(j-1)][j-1]);i表示区间起始点,j表示区间长度为(2^j)预处理时时间复杂度为O(nlogn)查询时时间复杂度为O(1)void RMQ_init(){for(int i=1;i<=n;i++)f[i][0]=a[i];for(int j=1;(1<&l

2020-08-02 20:52:44 64

原创 B. Captain Flint and a Long Voyage

time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputCaptain Flint and his crew keep heading to a savage shore of Byteland for several months already, drinking rum and telling stories. In such moments un

2020-08-02 20:29:33 255

原创 A. Captain Flint and Crew Recruitment

time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputDespite his bad reputation, Captain Flint is a friendly person (at least, friendly to animals). Now Captain Flint is searching worthy sailors to join h

2020-08-02 20:27:58 260

原创 11235 - Frequent values

11235 - Frequent valuesYou are given a sequence of n integers a 1 ,a 2 ,…,a n in non-decreasing order. In addition to that, youare given several queries consisting of indices i and j (1 ≤ i ≤ j ≤ n). For each query, determine themost frequent value amon

2020-08-01 00:21:17 125

原创 Ping pong

Ping pongN (3 ≤ N ≤ 20000) ping pong players live along a west-east street(consider the street as a line segment).Each player has a unique skill rank. To improve their skill rank, they often compete with each other. Iftwo players want to compete, they m

2020-07-31 21:06:15 134

原创 A. Acacius and String

time limit per test1 secondmemory limit per test512 megabytesinputstandard inputoutputstandard outputAcacius is studying strings theory. Today he came with the following problem.You are given a string s of length n consisting of lowercase English let.

2020-07-19 21:46:32 471

原创 E. Merging Towers

You have a set of n discs, the i-th disc has radius i. Initially,these discs are split among m towers: each tower contains at least onedisc, and the discs in each tower are sorted in descending order oftheir radii from bottom to top.You would like to .

2020-07-13 21:36:10 294

原创 D. Nastya and Scoreboard

Denis, after buying flowers and sweets (you will learn about thisstory in the next task), went to a date with Nastya to ask her tobecome a couple. Now, they are sitting in the cafe and finally…Denis asks her to be together, but … Nastya doesn’t give an.

2020-07-12 20:34:12 90

原创 E. Nearest Opposite Parity

传送口之前学长让我们练习最短路径时我摸鱼了,刚刚补了spf那部分知识点,训练就遇到类似的题,但是非常不好想,以后不摸鱼了。You are given an array a consisting of n integers. In one move, you can jump from the position i to the position i−ai (if 1≤i−ai) or to the position i+ai (if i+ai≤n).For each position i from 1

2020-07-07 00:16:33 223

原创 1436:数列分段II

1436:数列分段II时间限制: 1000 ms 内存限制: 65536 KB 提交数: 1455 通过数: 664 【题目描述】对于给定的一个长度为N的正整数数列A[i],现要将其分成M(M≤N)段,并要求每段连续,且每段和的最大值最小。关于最大值最小:例如一数列4 2 4 5 1要分成3段将其如下分段:[4 2][4 5][1]第一段和为6,第2段和为9,第3段和为1,和最大值为9。将其如下分段:[4][2 4][5 1]第一段和为4,第2段和为6,第3段和.

2020-06-18 17:44:06 204

原创 1435:【例题3】曲线

1435:【例题3】曲线时间限制: 1000 ms 内存限制: 65536 KB 提交数: 1005 通过数: 512 【题目描述】明明做作业的时候遇到了n个二次函数Si(x)=ax2+bx+c,他突发奇想设计了一个新的函数F(x)=max(Si(x)),i=1,2…n。明明现在想求这个函数在[0,1000]的最小值,要求精确到小数点后四位四舍五入。【输入】 输入包含T 组数据 (T<10) ,每组第一行一个整数 n(n≤10000),之后n行,每行3个整数a(0.

2020-06-17 21:39:27 786

原创 D. Task On The Board

Polycarp wrote on the board a string s containing only lowercase Latin letters (‘a’-‘z’). This string is known for you and given in the input.After that, he erased some letters from the string s, and he rewrote the remaining letters in any order. As a res

2020-06-17 15:32:58 230

原创 E. Maximum Subsequence Value

E. Maximum Subsequence Value time limit per test2 seconds memory limitper test256 megabytes inputstandard input outputstandard outputRidhiman challenged Ashish to find the maximum valued subsequence ofan array a of size n consisting of positive integer.

2020-06-08 17:10:57 286

原创 D. Solve The Maze

Vivek has encountered a problem. He has a maze that can be representedas an n×m grid. Each of the grid cells may represent the following:Empty — ‘.’ Wall — ‘#’ Good person — ‘G’ Bad person — ‘B’ The onlyescape from the maze is at cell (n,m).A person .

2020-06-08 16:34:43 269

原创 leetcode42,接雨水

双指针原理:凹class Solution {public: int trap(vector<int>& height) { int len=height.size(); if(len==0)return 0; int l=0,r=len-1; int total=0; int MAX1=height[0],MAX2=height[r]; while(l+1<r)

2020-06-07 22:26:53 51

原创 leetcode 41. 缺失的第一个正数

1.二分排序class Solution {public: int firstMissingPositive(vector<int>& nums) { sort(nums.begin(),nums.end()); int k=0; for(int i=0;i<nums.size();i++) { if(nums[i]<=0)continue; else

2020-06-07 21:53:16 66

原创 leetcode最长有效括号

1.栈操作class Solution {public: int longestValidParentheses(string s) { int len=s.size(),maxx=0; stack<int>bag;bag.push(-1); for(int i=0;i<len;i++) { if(bag.top()==-1||s[i]=='('||(s[i]==')'&&s

2020-06-07 20:27:31 92

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除