C. Constructing Tests time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Let's denote a m-free matrix as a binary (that is, consisting of only 1's and 0's) matrix such that every square submat…
这场打了小号 A. Word Correction time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Victor tries to write his own text editor, with word correction included. However, the rules of word correction are…
[比赛链接] 点击打开链接 [题解] Problem A Word Correction[字符串] 不用多说了吧,字符串的基本操作 Problem B  Run for your prize[贪心] 我们可以将这个数轴一分为二,小于等于500000的由第一个人领,否则由第二个人领 Problem C Constructing tests[贪心][数学] 首先我们发现 : N^2 - (N / M)^2 = x (N/M向下取整) 然后我们算出N的上下界,发现: sqrt(x+1)<=N<=sq…
题:https://codeforces.com/contest/1257/problem/E 题意:给定3个数组,可行操作:每个数都可以跳到另外俩个数组中去,实行多步操作后使三个数组拼接起来形成升序. 输出最小操作次数 dp: #include<bits/stdc++.h> using namespace std; ; ]; int a[M]; ///dp[i][0]表示前i个数全属于第一个数组所要花费的最小代价 ///dp[i][1]表示前i个数全属于第一.二个数组所要花费的最小代价 //…
TAT 第一场codeforces B. Array Walk #暴力 #贪心 题目链接 题意 有\(a1, a2, ..., an\) 个格子(每个格子有各自分数),最初为1号格(初始分数为\(a1\)),支持两种走法(经过的格子分数会相应累加),只能走\(k\)步:①向右走.②向左走,但是每一次向左操作走完一格后不能再连续地向左移动,允许向左走的操作次数为\(z\).现要求你走完k次后获得的最大分数. 分析 参考了官方题解,假定我们有\(t\)次移动是向左的,那么剩下\(k-t\)次向右,我…
传送门 Problem - C - Codeforces 题目 题目重点内容手打翻译:(欢迎批评指正) 在柏林, 使用着n套不同的货币(banknotes).第i个货币面额为10ai 元,货币的第一种只能是1.定义f(s)为需要s元的最小货币数量,例如货币面额分别为1,10,100,然后f(59) = 14 :因为 九个面额1元的货币和五个面额10元的货币,也就是9*1+5*10=59元,并且没有办法使用更少的货币数量 思路 尽量选择小面值的, 还不能被其它货币代替的, 也就是10ai+1  -…
题目链接 题目大意 给你一个长度为n的字符串,可以交换相邻两个元素,使得这个字符串翻转,求最少多少种次数改变 题目思路 如果要求数组排序所需要的冒泡次数,那其实就是逆序对 这个也差不多,但是如果是相同字符,用的应该是对应的最近的这个字母. 代码 #include<bits/stdc++.h> using namespace std; typedef long long ll; const int maxn=2e5+5; int n,cnt[30],ans[maxn],tree[maxn<…
Problem   Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship Time Limit: 2000 mSec Problem Description Input Output The only line should contain the minimal number of days required for the ship to reach the point (x2,y2)(x2,y2). If it…
Problem   Educational Codeforces Round 60 (Rated for Div. 2) - D. Magic Gems Time Limit: 3000 mSec Problem Description Input The input contains a single line consisting of 2 integers N and M (1≤N≤10^18, 2≤M≤100). Output Print one integer, the total n…
Educational Codeforces Round 43 (Rated for Div. 2) https://codeforces.com/contest/976 A #include<bits/stdc++.h> using namespace std; #define lson l,mid,rt<<1 #define rson mid+1,r,rt<<1|1 #define IT set<ll>::iterator #define sqr(x)…