[CF846A]Curriculum Vitae题解
枚举一个点,假设它一定符合条件,据此珂以\(O(n)\)算出要删去几个点
于是就\(O(n^2)\)解决了,貌似加一个前缀和可以在\(O(n)\)的时间复杂度内解决本问题,但对于这个数据范围来说\(O(n^2)\)戳戳有余
放个代码:
#include <cstdio>
#define ll long long
inline ll read(){
ll x = 0; int zf = 1; char ch = ' ';
while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar();
if (ch == '-') zf = -1, ch = getchar();
while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar(); return x * zf;
}
int a[105];
int main(){
int n = read();
for (int i = 1; i <= n; ++i)
a[i] = read();
int ans = 0, cnt;
for (int i = 1; i <= n; ++i){
cnt = 0;
for (int j = i + 1; j <= n; ++j)
if (!a[j])
++cnt;
for (int j = 1; j < i; ++j)
if (a[j])
++cnt;
if (n - cnt > ans)
ans = n - cnt;
}
printf("%d", ans);
return 0;
}
[CF846A]Curriculum Vitae题解的更多相关文章
- Resume (Curriculum Vitae)
The resume (Curriculum Vitae) is a selling tool outlining your skills and experience so an employer ...
- 问题 B: Curriculum Vitae
问题 B: Curriculum Vitae 时间限制: 1 Sec 内存限制: 128 MB提交: 109 解决: 25[提交][状态][讨论版][命题人:acm4302] 题目描述 Hideo ...
- 【CF Edu 28 A. Curriculum Vitae】
time limit per test 1 second memory limit per test 256 megabytes input standard input output standar ...
- google高级搜索
ext:php program_listing intitle:MythWeb.Program.Listing inurl:preferences.ini “[emule]” intitle:”Ind ...
- [BEC][hujiang] Lesson03 Unit1:Working life ---Grammar & Listening & Vocabulary
3 Working life p8 Grammar Gerund and infinitive(动名词和不定式) 一般而言: 1 动词后面接动名词还是不定式没有特定规则,主要取决于语言习 ...
- CV和Resume的区别(转)
常常有人把CV和Resume混起来称为“简历”,其实精确而言,CV应该是“履历”,Resume才是简历.Resume概述了有关的教育准备和经历,是对经验技能的摘要:curriculum vitae则集 ...
- Google Hack搜索技巧
想了解更多搜索技巧,点击下面网站了解http://exploit-db.com/google-dorks Google Hack的一些整理 这里是google关键字的用法,要设置它为中文,则是 htt ...
- PMP模拟考试-2
1. Increasing resources on the critical path activities may not always shorten the length of the pro ...
- 【Educational Codeforces Round28】
咸鱼选手发现自己很久不做cf了,晚节不保. A.Curriculum Vitae 枚举一下间断点的位置. #include<bits/stdc++.h> using namespace s ...
随机推荐
- spring boot gateway自定义限流
参考:https://blog.csdn.net/ErickPang/article/details/84680132 采用自带默认网关请参照微服务架构spring cloud - gateway网关 ...
- 您配置文件中的设置 (空密码的 root) 与 MySQL 默认管理员账户对应...的解决办法
您配置文件中的设置 (空密码的 root) 与 MySQL 默认管理员账户对应.……解决办法很简单:1.修改root@localhost权限的密码. 打开wamp的phpmyadmin,进入它的管理界 ...
- 第一个spring boot应用
前提 首先要确保已经安装了java和maven: $ java -version java version "1.8.0_102" Java(TM) SE Runtime Envi ...
- 【洛谷 p2672】推销员
推销员[题目链接] 好了为了凑字数先把题目复制一下: 好了题解第一篇正解: 首先输入,莫得什么好说的: scanf("%d",&n); ;i<=n;i++) scan ...
- HDU 3228 题解(最小生成树)(Kruskal)(内有详细注释)
Problem Description A group of explorers has found a solitary island. They land on the island and ex ...
- FZUOJ-2275 Game
Problem 2275 Game Accept: 159 Submit: 539 Time Limit: 1000 mSec Memory Limit : 262144 KB Pro ...
- H5白屏问题
前言 前阵子弄了灰度环境,H5这边需要给灰度环境的接口加上Cookie,配置的期间遇到一些Cookie问题以及白屏在此记录下 1.H5请求接口带不上Cookie 解决方法:前端使用了 webpack ...
- 回溯---IP 地址划分
IP 地址划分 93. Restore IP Addresses(Medium) Given "25525511135", return ["255.255.11.135 ...
- EF添加关联的提示问题:映射从第 260 行开始的片段时有问题:
一,EF添加关联的提示问题 严重性 代码 说明 项目 文件 行 禁止显示状态错误 错误 3004: 映射从第 260 行开始的片段时有问题:没有为 设置 T_xx_xxRelation 中的属性 T_ ...
- localeCompare按首字母排序汉字
sort() 方法用于对数组的元素进行排序. 如果想按照其他标准进行排序,就需要提供比较函数,该函数要比较两个值,然后返回一个用于说明这两个值的相对顺序的数字.比较函数应该具有两个参数 a 和 b,其 ...