[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 ...
随机推荐
- Delphi XE2 之 FireMonkey 入门(20) - TStyleBook(皮肤、样式相关)
我觉得叫 "皮肤" 不如叫 "样式" 或 "风格", 因为它可以包含和动作关联的动画. 在 FMX 下, 控件可以任意绘制, 各部件个性化的 ...
- CDN分发
CDN 是Content Delivery Network,即内容分发网络. 未完待续..
- window.open弹窗阻止问题解决之道
https://segmentfault.com/a/1190000015381923https://segmentfault.com/a/1190000014988094https://www.cn ...
- Visual Studio关于项目迁移或拉取代码产生的dll黄色感叹号警告问题解决方案
今天换了台大电脑,准备好好爽一下, 就把笔记本上的项目拷贝到了台式机上, 但是我没有拷贝解决方案整个文件夹,因为其中项目太多了,我就把其中一个项目的文件夹直接拷贝到电脑上,然后就出现了下面的情况. 这 ...
- source ~/.bash_profile是什么意思
~ 这个符号表示你的家目录,.bash_profile 是一个隐藏文件,主要是用来配置bash shell的,source -/.bash_profile 就是让这个配置文件在修改后立即生效.
- 毕业之后de经历
毕业之后 2016年7月,我大学毕业了.7月3号到7月6号,我陆续用我的小行李箱,在半夜12点左右,把我的生活用品拉出宿舍,大汗淋漓之后,我就在晚上12点多,找个奶茶店买一杯芒果冰沙.白天要去厦门的一 ...
- oracle--增删改、表备份、集合运算
truncate 插入数据学习及数据的备份 单表查询语句(select) 1.插入数据(insert) 1.语法规范 insert into 表名(字段1,字段2,字段3,....)values('值 ...
- ./configure 配置文件时出错checking for g++... no
checking for g++... no checking for c++... no checking for gpp... no checking for aCC... no 缺少C++编译器 ...
- hdu 3333 离线线段树 + 思维/树状数组 /在线主席树
#include<iostream> #include<cstdio> #include<string> #include<cmath> #includ ...
- 如何将datetimepicker默认设置为空?
在Load中,初始化 this.dateTimePicker1.Format=DateTimePickerFormat.Custom; his.dateTimePicker1.CustomFormat ...