- 博客(77)
- 资源 (1)
- 收藏
- 关注
原创 Codeforces Round #699 (Div. 2)
Codeforces Round #699 (Div. 2)http://codeforces.com/contest/1481A. Space Navigation题意:给你一个字符串,串中字母分别表示在二维平面上往上下左右四个方向走一格,问是否能够删除一些字母使得从(0,0)出发走到(x,y)思路:直接看最左最右,最上最下能到哪,然后看(x,y)是否在移动区间内#include<bits/stdc++.h>#define MAXN 100005using namespace s
2021-02-07 22:12:13
274
原创 Educational Codeforces Round 103 (Rated for Div. 2)
Educational Codeforces Round 103 (Rated for Div. 2)http://codeforces.com/contest/1476K-divisible Sum题意:给你n和k,需要构造一个长度为n的数组a(a中数都为正整数)使得所有数之和是k的倍数,要使得a中最大的数最小,问这个最小数是多少思路:首先a全放1和为n,全放2合为2n,如果n >= k那么n~2n之间必有k的倍数,否则先全放⌊k/n⌋\lfloor k/n \rfloor⌊k/n⌋,之后选
2021-01-30 01:23:05
209
原创 Codeforces Round #628 (Div. 2)
Codeforces Round #628 (Div. 2)http://codeforces.com/contest/1325A - EhAb AnD gCd#include<bits/stdc++.h>using namespace std;int t,x;int main(){ scanf("%d",&t); while(t--) { scanf(...
2020-03-15 00:44:50
146
原创 Educational Codeforces Round 83 (Rated for Div. 2)
Educational Codeforces Round 83 (Rated for Div. 2)http://codeforces.com/contest/1312/myA - Two Regular Polygons思路:m是n的因子即可#include<bits/stdc++.h>using namespace std;int t,n,m;int main(){...
2020-03-14 02:38:10
136
原创 E - Array Shrinking,区间dp,Educational Codeforces Round 83 (Rated for Div. 2)
E - Array Shrinking,Educational Codeforces Round 83 (Rated for Div. 2)http://codeforces.com/contest/1312/problem/EYou are given an array a1,a2,…,an. You can perform the following operation any numbe...
2020-03-14 02:37:50
189
原创 D. Count the Arrays,组合,Educational Codeforces Round 83 (Rated for Div. 2)
D. Count the Arrays,Educational Codeforces Round 83 (Rated for Div. 2)http://codeforces.com/contest/1312/problem/DYour task is to calculate the number of arrays such that:each array contains n elem...
2020-03-14 02:30:10
175
原创 Codeforces Round #622 (Div. 2)
Codeforces Round #622 (Div. 2)http://codeforces.com/contest/1313A - Fast Food Restaurant#include<bits/stdc++.h>using namespace std;int t,a[3];int main(){ scanf("%d",&t); while(t--)...
2020-02-25 00:51:40
337
原创 C2 - Skyscrapers (hard version),Codeforces Round #622 (Div. 2),单调栈
C2 - Skyscrapers (hard version)http://codeforces.com/contest/1313/problem/C2思路:首先枚举最高楼,由题意可知最高楼的两边都是递减的,现假设最高楼的下标为1,算出最优方案,之后每次将最高楼的下标向右平移,假设当前平移到i,发现要使得最高楼的左边递减,则需要将i左边第一个比它小的位置到i都置为m[i],右边同,这个用单点栈...
2020-02-25 00:51:23
202
原创 Kanade's convolution,HDU - 6057,FWT
Kanade’s convolution,HDU - 6057https://vjudge.net/problem/HDU-6057/originGive you two arrays A[0…2m−1] and B[0…2m−1].Please calculate array C[0…2m−1]:C[k]=∑i and j=kA[i xor j]∗B[i or j]You just n...
2020-02-19 14:43:03
162
原创 Binary Table,CodeForces - 662C,FWT,状压
Binary Table,CodeForces - 662Chttps://vjudge.net/problem/CodeForces-662C/originYou are given a table consisting of n rows and m columns. Each cell of the table contains either 0 or 1. In one move, y...
2020-02-19 13:12:11
158
原创 Super Rooks on Chessboard,UVA - 12633,FFT
Super Rooks on Chessboard,UVA - 12633https://vjudge.net/problem/UVA-12633/originLet’s assume there is a new chess piece named Super-rook. When placed at a cell of a chessboard, itattacks all the ce...
2020-02-19 12:34:33
242
原创 Hard Nim,HYSBZ - 4589,Nim博弈,FWT
Hard Nim,HYSBZ - 4589https://vjudge.net/problem/HYSBZ-4589/originClaris和NanoApe在玩石子游戏,他们有n堆石子,规则如下:Claris和NanoApe两个人轮流拿石子,Claris先拿。每次只能从一堆中取若干个,可将一堆全取走,但不可不取,拿到最后1颗石子的人获胜。不同的初始局面,决定了最终的获胜者,有些局面下...
2020-02-19 12:13:39
139
原创 A+B Problem,Kattis - aplusb,FFT
A+B Problem,Kattis - aplusbGiven N integers in the range [−50000,50000], how many ways are there to pick three integers ai, aj, ak, such that i, j, k are pairwise distinct and ai+aj=ak? Two ways are ...
2020-02-19 12:05:54
249
原创 HDU - 4609 ,3-idiots,FFT
HDU - 4609 ,3-idiotshttps://vjudge.net/problem/HDU-4609/originKing OMeGa catched three men who had been streaking in the street. Looking as idiots though, the three men insisted that it was a kind o...
2020-02-19 00:14:18
224
原创 HDU - 1402,A * B Problem Plus,FFT板
HDU - 1402,A * B Problem Plushttps://vjudge.net/problem/HDU-1402/originCalculate A * B.思路:FFT板题,贴个常数很小的板子#include<bits/stdc++.h>#define ll long long#define ri register int#define MAXN 500...
2020-02-18 23:47:20
159
原创 Tree,2017 ACM-ICPC 亚洲区(西安赛区)网络赛A,点分治
2017 ACM-ICPC 亚洲区(西安赛区)网络赛 A Treehttps://nanti.jisuanke.com/t/A1267There is a tree with nn nodes, at which attach a binary 64*6464∗64 matrix M_i (1 \le i \le n)Mi (1≤i≤n). There are qq queries f...
2020-02-18 21:54:25
249
原创 Codeforces Round #620 (Div. 2)
Codeforces Round #620 (Div. 2)https://codeforces.com/contest/1304A - Two Rabbits思路:注意特判a+b等于0的情况就好#include<bits/stdc++.h>using namespace std;int x,y,a,b;int main(){ int t; scanf("%d",&...
2020-02-15 23:33:28
138
原创 Codeforces Round #619 (Div. 2)
Codeforces Round #619 (Div. 2)https://codeforces.com/contest/1301A - Three Strings思路:只要a[i],b[i]中的一个和c[i]相等,直接把另一个和c[i]换就好#include<bits/stdc++.h>#define MAXN 105using namespace std;char a...
2020-02-15 13:34:32
235
原创 E. Xenon's Attack on the Gangs,Codeforces Round #614 (Div. 2),树形dp
E. Xenon’s Attack on the Gangshttp://codeforces.com/contest/1293/problem/EOn another floor of the A.R.C. Markland-N, the young man Simon “Xenon” Jackson, takes a break after finishing his project ea...
2020-02-14 21:23:28
244
原创 Educational Codeforces Round 82 (Rated for Div. 2)
Educational Codeforces Round 82 (Rated for Div. 2)https://codeforces.com/contest/1303A - Erasing Zeroes思路:直接看最左边和最右边的1中间有多少个0#include<bits/stdc++.h>using namespace std;int t;char s[105];...
2020-02-13 00:56:43
150
原创 E - Water Balance,Codeforces Round #618 (Div. 2),单调栈
E - Water Balancehttps://codeforces.com/contest/1300/problem/Eoutputstandard outputThere are n water tanks in a row, i-th of them contains ai liters of water. The tanks are numbered from 1 to n fro...
2020-02-12 01:33:38
157
原创 Codeforces Round #618 (Div. 2)
Codeforces Round #618 (Div. 2)http://codeforces.com/contest/1300A - Non-zero思路:首先0就加到1,然后如果总和为0的话肯定有正数,将其中任意一个加1就好#include<bits/stdc++.h>#define MAXN 105using namespace std;int t,n,a[MAXN...
2020-02-10 00:42:13
151
原创 E. Prefix Enlightenment,Codeforces Round #616 (Div. 2),拆点并查集
E. Prefix Enlightenmenthttp://codeforces.com/contest/1291/problem/E题意:有一个01字符串s,长度为n,有k个集合 A1,A2,...AkA_1,A_2,...A_kA1,A2,...Ak ,他们都是{ 1,2,...,n1,2,...,n1,2,...,n }的子集,选取集合 AiA_iAi 能将字符串s中对应下标的字...
2020-02-08 02:22:19
138
原创 Codeforces Round #617 (Div. 3)
Codeforces Round #617 (Div. 3)A - Array with Odd Sum思路:有奇偶数同时存在YES,只有奇数是n是奇数为YES,否则NO#include<bits/stdc++.h>#define MAXN 2005using namespace std;int n,t;int main(){ scanf("%d",&t);...
2020-02-05 00:53:35
1545
原创 Codeforces Round #616 (Div. 2)
http://codeforces.com/contest/1291/myA - Even But Not Even思路:先把末尾的偶数全部去掉,然后长度不为0的话看剩下的数字和是否为偶数,是的话直接输出,否则找一个奇数删去,注意不要有前导0#include<bits/stdc++.h>using namespace std;int t,n;char s[3005];in...
2020-02-03 01:39:03
149
原创 E. Permutation Separation,Educational Codeforces Round 81 (Rated for Div. 2),线段树
E. Permutation Separationhttp://codeforces.com/contest/1295/problem/EYou are given a permutation p1,p2,…,pn (an array where each integer from 1 to n appears exactly once). The weight of the i-th ele...
2020-01-30 19:01:44
927
2
原创 D. Same GCDs, Educational Codeforces Round 81 (Rated for Div. 2),欧拉函数
D. Same GCDs, Educational Codeforces Round 81 (Rated for Div. 2)You are given two integers a and m. Calculate the number of integers x such that 0≤x<m and gcd(a,m)=gcd(a+x,m).Note: gcd(a,b) is th...
2020-01-30 01:23:05
366
原创 Educational Codeforces Round 81 (Rated for Div. 2)
Educational Codeforces Round 81 (Rated for Div. 2)http://codeforces.com/contest/1295A. Display The Number思路:首先位数越多越好,那么直接不断的填1,但是只剩3段可以点亮时在首位填个7比较好#include<bits/stdc++.h>using namespace std...
2020-01-30 01:20:58
3320
原创 HDU - 6035,点分治,组合计数
Colorful Treehttps://vjudge.net/problem/938230/originThere is a tree with n nodes, each of which has a type of color represented by an integer, where the color of node i is ci.The path between each...
2020-01-18 18:43:37
444
原创 HDU - 4812,点分治
D Treehttps://vjudge.net/problem/48318/originThere is a skyscraping tree standing on the playground of Nanjing University of Science and Technology. On each branch of the tree is an integer (The tre...
2020-01-18 12:43:22
708
1
原创 HDU - 5469,点分治,hash,先处理子树
Antonidashttps://vjudge.net/problem/HDU-5469Given a tree with N vertices and N−1 edges. Each vertex has a single letter Ci. Given a string S, you are to choose two vertices A and B, and make sure th...
2020-01-18 10:29:32
392
原创 CodeChef PRIMEDST,点分治,FFT
Prime Distance On Treehttps://vjudge.net/problem/149908/originProblem description.You are given a tree. If we select 2 distinct nodes uniformly at random, what’s the probability that the distance b...
2020-01-17 11:06:35
220
原创 HDU - 5977,点分治,状压
Garden of Edenhttps://vjudge.net/problem/550645/originWhen God made the first man, he put him on a beautiful garden, the Garden of Eden. Here Adam lived with all animals. God gave Adam eternal life....
2020-01-16 21:20:49
217
原创 HYSBZ 2152,点分治
聪聪可可聪聪和可可是兄弟俩,他们俩经常为了一些琐事打起来,例如家中只剩下最后一根冰棍而两人都想吃、两个人都想玩儿电脑(可是他们家只有一台电脑)……遇到这种问题,一般情况下石头剪刀布就好了,可是他们已经玩儿腻了这种低智商的游戏。他们的爸爸快被他们的争吵烦死了,所以他发明了一个新游戏:由爸爸在纸上画n个“点”,并用n-1条“边”把这n个“点”恰好连通(其实这就是一棵树)。并且每条“边”上都有一个数。...
2020-01-16 17:21:56
154
原创 POJ - 2114,点分治
BoatherdsBoatherds Inc. is a sailing company operating in the country of Trabantustan and offering boat trips on Trabantian rivers. All the rivers originate somewhere in the mountains and on their wa...
2020-01-16 17:00:53
172
原创 POJ - 1741,点分治
A - TreeGive a tree with n vertices,each edge has a length(positive integer less than 1001).Define dist(u,v)=The min distance between node u and v.Give an integer k,for every pair (u,v) of vertices...
2020-01-16 16:11:01
159
原创 P3806 【模板】点分治1
P3806 【模板】点分治1给定一棵有 nn 个点的树。询问树上距离为 kk 的点对是否存在。思路:点分治,先选取一个重心root,算出每个点到它的距离,从而可以通过枚举两条路径能够组成的 询问距离 的次数,但是这样会将同一子树上的两条路径算上(即路径长度加上了两倍子节点到root的距离),将这种情况的贡献减去即可,这样就O(n)计算出了一颗经过root点的路径贡献,之后同样的对root的每...
2020-01-16 15:39:56
184
原创 A. Deadline,数论分块
Educational Codeforces Round 80 (Rated for Div. 2) A. Deadlinehttps://codeforces.com/contest/1288/problem/A思路:⌈dx+1⌉=⌊d+xx+1⌋=1+⌊d−1x+1⌋\lceil \frac{d}{x+1} \rceil=\lfloor\frac{d+x}{x+1}\rfloor=1+\...
2020-01-16 10:21:53
386
汇编语言编程全套(含DOS,debug.exe,exit.com,masm)
2018-10-11
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人