cf
文章平均质量分 69
出尘呢
广告位招租!
展开
-
【筛法应用】CF1558B - Up the Strip
https://codeforces.com/contest/1558/problem/B为什么要2*f[i-1]一个f[i-1]是f[i]–>f[i-1]一个f[i-1]是因为f[i-1]是sum(f[1~i-2])+筛法中连续的一块用第一个代替的叠加影响力以f[6]为例f[6]=f[5,4,3,2,1]+f[6/2,6/3,6/4,6/5,6/6]6,6/2是3筛的,加f[3],同时-f[2]表示/2是2的日子到头了6/3是2筛的,加f[2],同时-f[1]表示/3是1的日子到头了原创 2021-08-25 18:12:48 · 235 阅读 · 0 评论 -
【博弈论:倒腾思维】D. Deleting Divisors——Codeforces Round #726 (Div. 2)
https://codeforces.com/contest/1537/problem/D博弈论:倒腾1.n为非合数就会输2.让n变为非合数的会赢3.(需要想法)奇数好像可以变成非合数。奇数的因子是奇数,得到偶数4.由于该奇数是m(奇)n(奇)变为mn-m=m(奇)(n-1)(偶)偶数,所以又可以减m变为奇数m(n-2),迟早会减为非合数的。至此,奇数输,(奇)*(偶)赢5.只剩下不能分解成(奇)*(偶)的了,必是2的幂次。6.由于2输,2n要么减半要么减不到一半,如果不到一半,那又是原创 2021-08-08 23:09:35 · 176 阅读 · 1 评论 -
D. Lost Tree【树的二分图性质】——Codeforces LATOKEN Round 1 (Div. 1 + Div. 2)
树的性质:一棵树是二分的,可以被染成2种颜色交错距离为1为相邻,则看第一个后取奇偶少的的那一部分。关于交互题的Idleness limit exceeded on test 1:不是最后来一个fflush(stdout);也不是C++才需要,而是每一句输出都立刻加一句。#include<bits/stdc++.h>using namespace std;#ifdef LOCALFILE*FP=freopen("text.in","r",stdin);#endif#def原创 2021-06-14 18:47:29 · 709 阅读 · 4 评论 -
F. Omkar and Akmar【游戏,组合,逆元】—— Codeforces Round #724 (Div. 2)
https://codeforces.com/contest/1536/problem/F游戏游戏这方面,官方题解已经讲的很好了。https://codeforces.com/blog/entry/91520题目问的是the number of possible distinct games where both players playoptimally那我们只要把所有的结果考虑一下:AB交错,且AB之间最多有一个空格。这个时候游戏结束(也因此必是Omkar赢,因为如果场上还有奇数时原创 2021-06-09 00:15:49 · 1064 阅读 · 4 评论 -
E. Omkar and Forest——Codeforces Round #724 (Div. 2)
https://codeforces.com/contest/1536/problem/EImagine picking some subset of ‘#’ and making them 0. Then there is exactly one way to make all the remaining ‘#’ positive integers.——官方题解这句话非常重要。就是,让若干的#为0,每次这样选都会有一种符合解(因为多源BFS)。所以我们只要看有多少种不同的让若干#为0即可。计原创 2021-06-08 14:58:13 · 181 阅读 · 0 评论 -
D. Omkar and Medians——Codeforces Round #724 (Div. 2)
https://codeforces.com/contest/1536/problem/D这个又是往状态转移想,dp思路cd很常见!下一个状态,只能改变最多一个排位也一定可以改变一个排位。所以只要贪心,看上一个状态到当前是否可以即可,即不是到不了,更好判断。还有知识点:set是有序的next(p)next(p)next(p)和prev(p)prev(p)prev(p)函数会返回p的下一个/上一个指针。一个小技巧:墙:用INF和-INF,不用特判一个小bug:注意不要找到flag就习惯性b原创 2021-06-08 01:06:21 · 447 阅读 · 0 评论 -
【C++string用法】B. Prinzessin der Verurteilung—— Codeforces Round #724 (Div. 2)
B. Prinzessin der Verurteilung【C++string用法】推荐!!这里用到的:a+=,push_back,pop_back,sort[],a.size(),a.find(),string::npos=-1注意://std::ios::sync_with_stdio(false);//这一句话,不能再scanf等,会错了#include<bits/stdc++.h>#ifdef LOCALFILE*FP=freopen("text.in","r"原创 2021-06-07 15:57:56 · 518 阅读 · 0 评论 -
C. Diluc and Kaeya——Codeforces Round #724 (Div. 2)
C. Diluc and Kaeya一开始就想到了GCD,但是计数没想到。。打开思路,也多见见,不难理解//wa原因:不均分 //ac反思:计数方法,之前要有过等于之前相同状态记录一次 #include<bits/stdc++.h>#ifdef LOCALFILE*FP=freopen("text.in","r",stdin);#endifusing namespace std;int t,n;char a[500005];map<pair<int,int&原创 2021-06-07 15:53:46 · 227 阅读 · 0 评论 -
5、23做题总结
白天补校赛一题Doorman,斌姐姐的晚上一场cfdiv2感想:没想好解法就写的是dog校赛C题http://115.157.200.87/front/problem?problemId=1536斌姐姐的题1.离散化2.dp还是错的,5个小时这就是没有想清所有细节到了某些步骤就开始乱搞的结果。。。#include<bits/stdc++.h>#ifdef LOCALFILE*FP=freopen("text.in","r",stdin);#endifusing n原创 2021-05-25 01:45:51 · 106 阅读 · 0 评论 -
C. Sequence Pair Weight——Codeforces Round #721 (Div. 2)
https://codeforces.com/contest/1527/problem/CA sequence b is a subsegment of a sequence a if b can be obtained from a by deletion of several (possibly, zero or all) elements from the beginning and several (possibly, zero or all) elements from the end.——题原创 2021-05-21 19:53:46 · 115 阅读 · 0 评论 -
【博弈论】B1. Palindrome Game (easy version)—— Codeforces Round #721 (Div. 2)
https://codeforces.com/contest/1527/problem/B1/*当0, B,差1当00,B,差2当000,A,中间多1,但最后少2对于00,A1B1可以讨论:eke——只有中间一个0的时候,bob赢。0个数是偶数时,alice每次放一个,bob就放对称,最后一对0,alice填了一个给bob的时候bob不放,这样bob总是比alice少填2个为奇数的时候,alice填中间那个,把偶数的时候alice面对的状态转移给bob,这样alice总是比bob少填2-1个原创 2021-05-21 14:15:44 · 201 阅读 · 0 评论 -
D. Armchairs——Educational Codeforces Round 109 (Rated for Div. 2)
D. Armchairstime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputThere are n armchairs, numbered from 1 to n from left to right. Some armchairs are occupied by people (at most one person per armchair),原创 2021-05-16 20:54:05 · 349 阅读 · 2 评论 -
D. Binary Literature_Codeforces Round #715 (Div. 2)
000000101011011101D. Binary Literaturetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputA bitstring is a string that contains only the characters 0 and 1.Koyomi Kanou is working hard towards her原创 2021-05-05 13:08:35 · 154 阅读 · 0 评论 -
D. Cut and Stick
D. Cut and Sticktime limit per test3 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputBaby Ehab has a piece of Cut and Stick with an array a of length n written on it. He plans to grab a pair of scissors and do the foll原创 2021-05-04 11:13:14 · 244 阅读 · 0 评论 -
【区间倍增dp】D. Cut——Codeforces Round #717 (Div. 2)
D. Cuttime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis time Baby Ehab will only cut and not stick. He starts with a piece of paper with an array a of length n written on it, and then he does the原创 2021-05-03 23:39:00 · 235 阅读 · 0 评论 -
D. Bananas in a Microwave CodeCraft-21 and Codeforces Round #711 (Div. 2)
D. Bananas in a Microwavetime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou have a malfunctioning microwave in which you want to put some bananas. You have n time-steps before the microwave stops原创 2021-05-03 19:58:00 · 164 阅读 · 0 评论 -
【模拟】D. 3-Coloring——Codeforces Round #712 (Div. 2)
D. 3-Coloringtime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis is an interactive problem.Alice and Bob are playing a game. There is n×n grid, initially empty. We refer to the cell in row i and原创 2021-05-03 15:04:05 · 178 阅读 · 0 评论 -
记忆化搜索DP:D - Explorer Space
Contest 2050 and Codeforces Round #718 (Div. 1 + Div. 2)D. Explorer Spacetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are wandering in the explorer space of the 2050 Conference.The explore原创 2021-05-03 11:42:04 · 163 阅读 · 0 评论 -
Div2D题目录
#define C D前言C题及格,D题再接再厉,争取早日上蓝什么时候Div2D题对的比不会的多了什么时候就出师限时:1h补题限时:1h每天题量:3题——能按时AC2题,就出师5.3日训练题目CFdiv2 D题目录:Contest 2050 and Codeforces Round #718 (Div. 1 + Div. 2) Codeforces Round #712 (Div. 2)CodeCraft-21 and Codeforces Round #711 (Div. 2)原创 2021-05-03 09:42:14 · 260 阅读 · 0 评论 -
C. Planar Reflections【动态规划图解】——CodeCraft-21 and Codeforces Round #711 (Div. 2)
C. Planar Reflectionstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputGaurang has grown up in a mystical universe. He is faced by n consecutive 2D planes. He shoots a particle of decay age k at the p原创 2021-05-01 02:31:14 · 279 阅读 · 1 评论 -
F. Fair Distribution——The 18th Zhejiang Provincial Collegiate Programming Contest
F. Fair Distributiontime limit per test1 secondmemory limit per test512 megabytesinputstandard inputoutputstandard outputThere are n robots and m energy bars in the Dream Kingdom. DreamGrid, the king, is trying to make a fair distribution of the energ原创 2021-04-30 20:19:40 · 1190 阅读 · 5 评论 -
Educational Codeforces Round 108 (Rated for Div. 2)——D. Maximum Sum of Products
D. Maximum Sum of Productstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given two integer arrays a and b of length n.You can reverse at most one subarray (continuous subsegment) of the a原创 2021-04-30 17:10:15 · 129 阅读 · 1 评论 -
Div2C题目录
前言感觉不能好高骛远,那个题解我打算放一放了,多朴素练一下cf的div2的C题什么时候Div2C题对的比不会的多了什么时候就出师限时:1h补题限时:1h每天题量:3题——能按时AC2题,就出师4.30日训练题目CFdiv2 c题目录:Contest 2050 and Codeforces Round #718 (Div. 1 + Div. 2) Codeforces Round #712 (Div. 2)CodeCraft-21 and Codeforces Round #711 (原创 2021-04-30 01:55:29 · 241 阅读 · 0 评论 -
Educational Codeforces Round 108 (Rated for Div. 2)——vector用法以及不超时解法
C. Berland Regionaltime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputPolycarp is an organizer of a Berland ICPC regional event. There are n universities in Berland numbered from 1 to n. Polycarp know原创 2021-04-30 01:37:35 · 156 阅读 · 0 评论 -
Codeforces Round #717 (Div. 2) B. AGAGA XOOORRR
B. AGAGA XOOORRRtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputBaby Ehab is known for his love for a certain operation. He has an array a of length n, and he decided to keep doing the following ope原创 2021-04-22 01:27:14 · 319 阅读 · 1 评论 -
Codeforces Round #716 (Div. 2) C. Product 1 Modulo N
C. Product 1 Modulo Ntime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputNow you get Baby Ehab’s first words: “Given an integer n, find the longest subsequence of [1,2,…,n−1] whose product is 1 modulo n原创 2021-04-20 01:30:21 · 256 阅读 · 1 评论 -
B. TMT Document—— Codeforces Round #715 (Div. 2)
题意:一组中,给一个字符串只有T,M,看是否可以只分为子串TMT53TMT3MTT6TMTMTT6TMTTTT6TTMMTT一直找不到规律,后来看一下灰名朋友的代码,很亲入门新手://规律:左边,右边计数,T 个数只要都不小于 M 就可以了关键是如何想到呢?思路:1.多分析如何判断,严格证明再写,少wa少错。2.观察规律:为什么给的是特定的,对称的TMT,不是任意子串?想到这个,就可以从这找办法,3.想不到,也要从是DIV2B题不应该难,找到特殊性DIV2前几道原创 2021-04-17 02:22:30 · 210 阅读 · 0 评论 -
Educational Codeforces Round 107 (Rated for Div. 2)——C. Yet Another Card Deck
C. Yet Another Card Decktime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou have a card deck of n cards, numbered from top to bottom, i. e. the top card has index 1 and bottom card — index n. Each原创 2021-04-13 07:40:54 · 203 阅读 · 0 评论 -
Educational Codeforces Round 107 (Rated for Div. 2)——D. Min Cost String
D. Min Cost Stringtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputLet’s define the cost of a string s as the number of index pairs i and j (1≤i<j<|s|) such that si=sj and si+1=sj+1.You are g原创 2021-04-13 01:22:38 · 248 阅读 · 1 评论