[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 ...
随机推荐
- 启动tomcat报错One or more listeners failed to start,却找不到任何错误日志的临时解决方案
在整合spring和quartz时,启动tomcat,服务台报以上错误,却找不到任何错误日志…… 参考了https://www.cnblogs.com/sxdcgaq8080/p/8005886.ht ...
- 阶段1 语言基础+高级_1-3-Java语言高级_04-集合_06 Set集合_4_Set集合存储元素不重复的原理
set集合元素为什么不能重复 集合重写了toString的方法所以打印是里面的内容 往里面存了三次abc 哈希表,初始容量是16个 set集合存储字符串的时候比较特殊 横着是数组,竖着就是链表结构.跟 ...
- source ~/.bash_profile是什么意思
~ 这个符号表示你的家目录,.bash_profile 是一个隐藏文件,主要是用来配置bash shell的,source -/.bash_profile 就是让这个配置文件在修改后立即生效.
- Android安全测试(二)反编译检测
1.测试环境 SDK: Java JDK, Android SDK. 工具: 7zip, dex2jar, jd-gui 2.操作步骤 第一步:把apk改后缀名为zip 第二步:将zip文件解压,得到 ...
- 20191105 《Spring5高级编程》笔记-【目录】
背景 开始时间:2019/09/18 21:30 Spring5高级编程 版次:2019-01-01(第5版) Spring5最新版本:5.1.9 CURRENT GA 官方文档 Spring Fra ...
- Maven系列学习(三)Maven生命周期和插件
Maven生命周期和插件 Maven另外的两个核心概念就是生命周期和插件,Maven的生命周期都是抽象的,其实实际行为都是由插件来完成的,生命周期和插件两者协同工作 1.生命周期 Maven的生命周期 ...
- Java-Lambda表达式第二篇认识Lambda表达式
接上面的方法引用和构造器引用: 3>引用某类对象的实例方法 @FunctionalInterface public interface Cut{ String cut(String str,in ...
- Ant-编译构建(1)-HelloWorld
1.项目目录构成,lib包暂时为空,本次例子未引入第三方包. 2.编写相关的build.xml <?xml version="1.0" encoding="utf- ...
- Redis 21问,你接得住不?
作者:菜鸟小于 cnblogs.com/Young111/p/11518346.html 1.什么是redis? Redis 是一个基于内存的高性能key-value数据库. 2.Reids的特点 R ...
- [BZOJ4182]Shopping (点分治+树上多重背包+单调队列优化)
[BZOJ4182]Shopping (点分治+树上多重背包+单调队列优化) 题面 马上就是小苗的生日了,为了给小苗准备礼物,小葱兴冲冲地来到了商店街.商店街有n个商店,并且它们之间的道路构成了一颗树 ...