自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 Codeforces Round #637 (Div. 2)D. Nastya and Scoreboard【DP】

D. Nastya and Scoreboardtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputDenis, who managed to buy flowers and sweets (you will le...

2020-04-24 14:31:05 650

原创 Codeforces Round #633 (Div. 1)C. Perfect Triples

C. Perfect Triplestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputConsider the infinite sequencessof positive integers, create...

2020-04-13 15:17:04 506

原创 Educational Codeforces Round 85 (Rated for Div. 2)E. Divisor Paths【数学推导】

E. Divisor Pathstime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a positive integerDD. Let's build the following g...

2020-04-12 16:43:30 558 1

原创 Codeforces Round #629 (Div. 3)F. Make k Equal

F. Make k Equaltime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given the arrayaaconsisting ofnnelements and the inte...

2020-03-27 14:59:53 672

原创 Codeforces Round #627 (Div. 3)F - Maximum White Subtree【DFS】

F. Maximum White Subtreetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a tree consisting ofnnvertices. A tree i...

2020-03-13 15:05:59 776

原创 Educational Codeforces Round 83 (Rated for Div. 2)E. Array Shrinking【DP】

E. Array Shrinkingtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an arraya1,a2,…,ana1,a2,…,an. You can perform t...

2020-03-10 19:05:38 713

原创 CodeCraft-20 (Div. 2)E. Team Building【DP】

E. Team Buildingtime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAlice, the president of club FCB, wants to build a team for the ...

2020-03-06 15:37:35 476

原创 Codeforces Round #624 (Div. 3)简要题解

A. Add Odd or Subtract Even题意:给两个数xy,每次对x加上一个奇数或者减去一个偶数,问从x变到y的最小操作次数。分析:判断一下x和y的奇偶性讨论一下就可以了。#include <bits/stdc++.h>using namespace std;int main(){ int t; cin>>t; whi...

2020-02-27 12:44:39 396

原创 Codeforces Round #613 (Div. 2)F. Classical?【反演】

F. Classical?time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputGiven an arrayaa, consisting ofnnintegers, find:max1≤i<j≤...

2020-01-12 11:12:23 408

原创 2018-2019 ACM-ICPC, Asia Nanjing Regional Contest M - Mediocre String Problem【后缀数组】+【回文树】

题意:给定两个字符串s,t。从s中找一个子串ss,从t中找一个前缀tt,len(ss)>len(tt),求ss+tt是回文串的方案数。分析:简单来说,将s串翻转,然后枚举t的前缀,找出s中和该前缀相等的子串,对每个这样的子串,找出该子串前面长度不为0的回文串的个数,累加一下答案就可以了。首先把s串翻转,用回文树处理出翻转之后的s串的每个点,以该点结尾的回文串个数,然后将翻转后的s和t...

2020-01-11 14:14:20 336

原创 HDU - 4746 Mophues

MophuesTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 327670/327670 K (Java/Others)Total Submission(s): 2824Accepted Submission(s): 1215Problem DescriptionAs we know, any positiv...

2020-01-11 13:49:43 319

原创 bzoj - 2754 [SCOI2012]喵星球上的点名【后缀数组】+【RMQ】+【二分】+【离线】+【树状数组】

2754: [SCOI2012]喵星球上的点名Time Limit:20 SecMemory Limit:128 MBSubmit:3171Solved:1481[Submit][Status][Discuss]Descriptiona180285幸运地被选做了地球到喵星球的留学生。他发现喵星人在上课前的点名现象非常有趣。 假设课堂上有N个喵星人,每个喵星人的名...

2020-01-08 15:08:12 342 3

原创 Educational Codeforces Round 78 (Rated for Div. 2)F. Cards

F. Cardstime limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputConsider the following experiment. You have a deck ofmmcards, and exac...

2020-01-07 19:51:31 512 2

原创 Good Bye 2019 F. Awesome Substrings【分块暴力】

F. Awesome Substringstime limit per test8 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputLet's call a binary stringssawesome, if it has at least1...

2020-01-07 19:34:15 633

原创 Codeforces Round #611 (Div. 3)简要题解

A. Minutes Before the New Year题意:求当前时间到0点还有多少分钟分析:用24*60-当前分钟数。#include <bits/stdc++.h>using namespace std;int main(){ int t;cin>>t; while(t--){ int h,m; c...

2020-01-06 19:30:01 530

原创 Codeforces Round #599 (Div. 2)E. Sum Balance【子集DP】

E. Sum Balancetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputUjan has a lot of numbers in his boxes. He likes order and balance,...

2019-11-08 19:49:42 511

原创 Codeforces Round #598 (Div. 3)F - Equalizing Two Strings

F. Equalizing Two Stringstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given two stringsssandttboth of lengthnnan...

2019-11-05 18:35:28 471 1

原创 Codeforces Round #598 (Div. 3)E - Yet Another Division Into Teams【dp】

E. Yet Another Division Into Teamstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere arennstudents at your university. The ...

2019-11-05 18:29:19 454

原创 Codeforces Round #596 (Div. 2, based on Technocup 2020 Elimination Round 2)F. Tree Factory

F. Tree Factorytime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputBytelandian Tree Factory produces trees for all kinds of industri...

2019-11-01 15:38:25 293

原创 Codeforces Round #596 (Div. 2, based on Technocup 2020 Elimination Round 2) E - Rock Is Push【DP】

E. Rock Is Pushtime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputYou are at the top left cell(1,1)(1,1)of ann×mn×mlabyrinth. Y...

2019-11-01 15:29:59 291

原创 2017-2018 ACM-ICPC Latin American Regional Programming Contest G - Gates of uncertainty【树形DP】

题意:给定由N个与非门组成的树,有若干个与非门无论什么输入,输出都是1或0,求输出答案错误的输入方案数。分析:每个点维护一个矩阵,其中a表示该点输出为0且该输出是错误的方案数,b表示该点输出为0且该输出是正确的方案数,c表示该点输出为1且该输出是错误的方案数,d表示该点输出为1且该输出是正确的方案数。简称为错0,错1,对0,对1.可以得到错0 = 左错1*右对1+左对1*右错1+左...

2019-10-31 16:11:07 336

原创 2017-2018 ACM-ICPC Latin American Regional Programming Contest E - Enigma【DP】

题意:给一个由若干个‘?’和一些数字组成的数S,和一个数N,现在要求在?处填数,使其能够整除N并且值最小。分析:用DP[i][j]表示后i位组成的数,能否构成模N为j的数。然后枚举记录一个前缀的和对n取模,判断一下是否存在dp[i+1][n-mod]=1就可以了。#include <bits/stdc++.h>using namespace std;char s[10...

2019-10-31 15:53:06 541

原创 2017-2018 ACM-ICPC Latin American Regional Programming Contest D - Daunting device【分块】

题意:每次操作将区间颜色置为x,要求可以查询某个颜色出现次数,强制在线,求最后出现次数最多的颜色的次数。分析:考虑分块做法。对于每个块记录一个laz,laz为0表示这个块中的颜色不唯一,否则表示该颜色。更新时两端暴力更新,若整块的laz不为0,直接O(1)得到,否则暴力更新。分析一下复杂度,两端暴力更新O(n^1/2),laz不为0的块O(1),laz为0的块O(n^1/2)。...

2019-10-31 15:47:07 281

原创 2017-2018 ACM-ICPC Latin American Regional Programming Contest B - Buggy ICPC

题意:辅音字符直接放在后面,元音放在后面再翻转一下,问有几种方式达到给定的串s。分析:反向推,有几种情况。(1)串的开头末尾都是辅音,直接删去。(2)串的开头末尾都是元音,元音只能通过翻转出现在末尾,故需要翻转后去掉末尾。(3)串首辅音,串尾元音,GG。(4)当串的末尾是辅音,开头是元音,可以直接去掉辅音,也可以翻转后去掉元音。但是翻转后去掉元音后,串的开头就变成了辅音,若此时...

2019-10-31 15:37:20 391

原创 Codeforces Round #589 (Div. 2)E. Another Filling the Grid【容斥】+【二项式定理】

E. Another Filling the Gridtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou haven×nn×nsquare grid and an integerkk. Put an ...

2019-10-27 10:39:15 302

原创 Codeforces Round #596 (Div. 2, based on Technocup 2020 Elimination Round 2)D - Power Products

D. Power Productstime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputYou are givennnpositive integersa1,…,ana1,…,an, and an integ...

2019-10-27 10:38:57 529

原创 Codeforces Round #596 (Div. 2, based on Technocup 2020 Elimination Round 2)C - p-binary【暴力】

C. p-binarytime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputVasya will fancy any number as long as it is an integer power of two....

2019-10-27 10:35:32 856 5

原创 Codeforces Round #590 (Div. 3)简要题解

A - Equalize Prices Again分析:向上取整就可以了。#include "bits/stdc++.h"using namespace std;int main() { int t; cin>>t; while(t--){ int n; cin>>n; int sum...

2019-10-08 18:30:14 392

原创 读入bmp格式图片并且对该图片进行反色

bmp文件由bmp文件头,位图信息头,调色板,位图数据组成,24位没有调色板。#include <stdio.h>#include <windows.h>#include <math.h>#include <stdlib.h>int main(){ BITMAPFILEHEADER bmfHeader; BITMA...

2019-10-01 17:42:35 843

原创 2017-2018 ACM-ICPC, Asia Daejeon Regional Contest H - Rock Paper Scissors【FFT】

题意:给你两个字符串,由RSP组成,分别代表石头剪刀布,你可以改变你开始出拳的时间(但不能小于0),求最多能赢几次。分析:对手是s串,自己是t串,即把t串中的R换成S,S换成P,P换成R,然后在S中找一个子串匹配个数最多。固定s不动,移动t,令,我们把RSP分开算3次,以R为例,s[i]=1表示这个位置是R,反之不是,t同理。然后把RSP三种情况对应求和,然后再求个最大值就可以了,问题在于...

2019-09-28 15:40:40 406 2

原创 Codeforces Round #588 (Div. 2)简要题解【暴力场】

A - Dawid and Bags of Candies分析:两种情况【暴力】枚举一下就可以了。#include "bits/stdc++.h"using namespace std;int main(){ int a[4]; for (int i = 0; i < 4; ++i) { cin>>a[i]; } ...

2019-09-26 16:24:46 431

原创 Codeforces Round #587 (Div. 3)简要题解

A - Prefixes分析:模拟一下就可以了。#include "bits/stdc++.h"using namespace std;int main(){ int n; string s; cin>>n>>s; int ans = 0; for (int i = 0; i < n; ++i) { ...

2019-09-22 15:42:48 326

原创 Codeforces Round #585 (Div. 2)简要题解

A - Yellow Cards分析:分k1和k2的大小情况讨论一下就可以了。#include "bits/stdc++.h" using namespace std;const int mod = 1e9 + 7;const int maxn = 1e6 + 4;struct BIT { int n;vector<int> v; BIT(int ...

2019-09-19 14:41:09 282

原创 Educational Codeforces Round 71 (Rated for Div. 2)简要题解

A - There Are Two Types Of Burgers分析:分一下两种汉堡的加个大小讨论一下就可以了。#include "bits/stdc++.h" using namespace std; struct edge { int u, v, w; bool friend operator<(edge a, edge b) { ...

2019-09-10 18:08:24 567

原创 Codeforces Round #582 (Div. 3)简要题解

A - Chips Moving分析:不改变奇偶的情况下是免费的,那么数一下奇数和偶数的个数就可以了。#include "bits/stdc++.h"using namespace std;int main(){ int n; int od=0,ev=0; cin>>n; int x; while(n--){ cin...

2019-09-04 15:32:38 566

原创 hdoj - 5608 function【杜教筛】+【莫比乌斯反演】

functionTime Limit: 6000/3000 MS (Java/Others)Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1908Accepted Submission(s): 678Problem DescriptionThere is a functionf(x),...

2019-08-29 14:21:30 203

原创 hdoj - 6704 K-th occurrence(2019ccpc网络赛)【后缀数组】+【RMQ】+【主席树】

K-th occurrenceTime Limit: 3000/3000 MS (Java/Others)Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 1084Accepted Submission(s): 343Problem DescriptionYou are given a ...

2019-08-27 11:11:52 358

原创 2019 Multi-University Training Contest 10

1003 - Valentine's Day#include "bits/stdc++.h"using namespace std;const int mod = 1e9 + 7;const double eps = 1e-8;double dcmp(double a) { if (a > eps)return 1; if (a < -eps)retur...

2019-08-24 09:57:17 257

原创 2019 Multi-University Training Contest 9

可持久化鸽1002 -Rikka with Cake#include <iostream>#include <cstdio>#include <cmath>#include <string>#include <cstring>#include <algorithm>#include <limit...

2019-08-20 10:00:13 172

原创 Codeforces Round #580 (Div. 2)D. Shortest Cycle【floyd】

D. Shortest Cycletime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are givennninteger numbersa1,a2,…,ana1,a2,…,an. Consider ...

2019-08-19 10:55:54 305 3

空空如也

空空如也

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

TA关注的人

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