
基础算法c
文章平均质量分 63
简单算法
Dejavuuuuuu
不是在WA,就是在WA的路上
展开
-
2518: 最大下降矩阵
我们称一个矩阵是下降矩阵,当且仅当,矩阵的每一列都是严格下降的。很显然,这个要求很苛刻,大多数矩阵都无法满足。但是显然如果消去一些行,一定可以使得这个矩阵变成下降矩阵。我们可以把每一行看成一组元素,然后进行判断,之后求出最大下降的行数最后用总行数-最大下降行数即为所需小曲的行数。现在给出一个n行m列的矩阵,请你求出最少消去多少行,可以使得这个矩阵变为下降矩阵。输入第一行包含两个正整数n,m分别表示矩阵的行数和列数。(1原创 2023-04-21 17:30:08 · 109 阅读 · 0 评论 -
洛谷 P1824 进击的奶牛(二分)
题目链接题目描述Farmer John 建造了一个有NN(22\le≤NN\le≤100000100000) 个隔间的牛棚,这些隔间分布在一条直线上,坐标是x_1x1,...,x_NxN(0\le≤x_ixi\le≤10000000001000000000)。他的CC(22\le≤CC\le≤NN) 头牛不满于隔间的位置分布,它们为牛棚里其他的牛的存在而愤怒。为了防止牛之间的互相打斗,Farmer John 想把这些牛安置在指定的隔间,所有牛中相邻两头的最...原创 2022-05-13 12:39:43 · 171 阅读 · 0 评论 -
ZZULIOJ 2694: 发通知(map差分)
题目链接2694: 发通知时间限制:5Sec内存限制:512 MB提交:1053解决:244[状态] [讨论版] [提交] [命题人:admin]题目描述学院一共有n位学生,用1编号。每天,学院都会派遣辅导员给学生发送若干通知,以保证各项措施、活动消息得到落实。现在,学院要求辅导员发送一条关于光盘行动的通知。对于通知信息,同学们的反应往往各不相同,辅导员预测出第i号学生收到通知后会产生wi的愉悦度。此外,辅导员还观察到第i号学生会在[ai,bi]...原创 2022-05-09 10:00:03 · 190 阅读 · 0 评论 -
ZZULIOJ 2692: 我得重新集结部队
2692: 我得重新集结部队http://acm.zzuli.edu.cn/problem.php?id=2692#include<bits/stdc++.h>using namespace std;struct node{ int type;//虫=1,狂=2 long long x,y,h,atk,r; int liu; ==2时狂离开}p[3000];int main(){ int n;cin>>n; int o=-1; while(n--)原创 2022-05-06 13:44:14 · 191 阅读 · 0 评论 -
ZZULIOJ 2825: 收集金币
2825: 收集金币http://acm.zzuli.edu.cn/problem.php?id=2825可以用一个二维数组f[i][0]表示没有使用过技能;f[i][1]表示使用过技能;我们可以找出这个题的状态转移方程:f[i][0]=f[i][0]+x;f[i][1]=max(f[i][0],f[i][1]+x);#include<iostream>#include<cstring>#include<algorithm>using na原创 2022-05-05 18:22:13 · 466 阅读 · 0 评论 -
ZZUILIOJ 2836: 黑曜石
ZZUILIOJ 2836: 黑曜石http://acm.zzuli.edu.cn/problem.php?id=2836#include<bits/stdc++.h>using namespace std;long long c[200010],h[200010];bool cmp(int a,int b){ return a>b;}int main(){ int t;cin>>t; while(t--) { int n,cnt=0; ci原创 2022-05-05 18:11:03 · 98 阅读 · 0 评论 -
ZZULIOJ 2834: 小凯的书架
2834: 小凯的书架http://acm.zzuli.edu.cn/problem.php?id=2834注意k大于n的情况。此题数据较大,注意输出输入的时候用scanf,printf。#include<iostream>#include<cstring>#include<cstdio>using namespace std;typedef long long LL;LL a[300005];int main(){ int t; cin>原创 2022-05-05 18:09:14 · 683 阅读 · 0 评论 -
河南省第十三届ICPC程序设计竞赛 I题-七便士
题目描述七便士谜题是一个古老的谜题(如下左图),其规则如下:• 方盘上有八个圆坑,每个圆坑能正好放置一枚便士,每个圆坑与其他另外两个圆坑相连(图中黑线);• 每次操作分为两部分:(每次操作两部分缺一不可)将一枚便士放置于一个尚未放置便士的圆坑中; 再将该便士沿着黑线移动至另一尚未放置便士的圆坑中;• 目标为成功放置七枚便士;为更好理解七便士谜题规则,现将圆坑按顺时针1~8编号,如上右图所示,i(1≤i≤8)i\ (1 \leq i \leq 8)i(1≤i≤8)圆坑与(i+2)..原创 2022-05-03 16:50:12 · 1644 阅读 · 0 评论 -
Three displays CodeForces - 987C
It is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.There are nnn displays placed along a road, and the iii-th of them can display a原创 2022-04-30 16:30:34 · 411 阅读 · 0 评论 -
- Division by Two and Permutation CodeForces - 1624C
You are given an array aaa consisting of nnn positive integers. You can perform operations on it.In one operation you can replace any element of the array aia_iai with ⌊ai2⌋\lfloor \frac{a_i}{2} \rfloor⌊2ai⌋, that is, by an integer part of dividing ai原创 2022-04-30 16:19:11 · 199 阅读 · 0 评论 -
Make AP CodeForces - 1624B
Polycarp has 333 positive integers aaa, bbb and ccc. He can perform the following operation exactly once.Choose a positive integer mmm and multiply exactly one of the integers aaa, bbb or ccc by mmm.Can Polycarp make it so that after performing the oper原创 2022-04-30 16:10:17 · 299 阅读 · 0 评论 -
- Game CodeForces - 1649A
You are playing a very popular computer game. The next level consists of nnn consecutive locations, numbered from 111 to nnn, each of them containing either land or water. It is known that the first and last locations contain land, and for completing the l原创 2022-04-30 16:05:02 · 262 阅读 · 0 评论 -
D - Colorful Stamp CodeForces - 1669D
https://codeforces.com/problemset/problem/1669/Dhttps://codeforces.com/problemset/problem/1669/DA row of nnn cells is given, all initially white. Using a stamp, you can stamp any two neighboring cells such that one becomes red and the other becomes blue.原创 2022-04-26 13:48:40 · 848 阅读 · 0 评论