Codeforces 900C Remove Extra One 模拟】的更多相关文章

题目链接:900C Remove Extra One 题意: 首先record是指这个数比数列前面的所有数都大,给了n个数(1-n),删掉一个数,让整个数列的record值达到最大. 题解: 刚开始我的思路是求这个数列中前面比这个数大的有几个(因为只有前面只有一个数大于这个数的数可以增加record值)求出后找比求出个数为1的数大的最近数.后来发现这中方法代码量实在太大了,而且在求出后再求最近的大于这个数的数的复杂度也好像不够. 后来看了题解,发现只要换一种思路就很简单,那就是求删除某个位置上的…
You are given a permutation p of length n. Remove one element from permutation to make the number of records the maximum possible. We remind that in a sequence of numbers a1, a2, ..., ak the element ai is a record if for every integer j (1 ≤ j < i) t…
C. Remove Extra One time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given a permutation p of length n. Remove one element from permutation to make the number of records the maximum…
CodeForces.158A Next Round (水模拟) 题意分析 校赛水题的英文版,坑点就是要求为正数. 代码总览 #include <iostream> #include <cstdio> #include <algorithm> #include <cstring> #include <sstream> #include <set> #include <map> #include <queue>…
[CodeForces - 1272D] Remove One Element [线性dp] 标签:题解 codeforces题解 dp 线性dp 题目描述 Time limit 2000 ms Memory limit 262144 kB Source Codeforces Round #605 (Div. 3) Tags brute force   dp   *1500 Site https://codeforces.com/problemset/problem/1272/D 题面 Exam…
题目链接 题意:让你去掉一个数,使得剩下的数的record最多,当1≤j<i的aj<ai1 \leq j< i的a_j<a_i1≤j<i的aj​<ai​时aia_iai​为recordrecordrecord数. 解法:遍历数组每个数,记录最大和次大值,用cntcntcnt数组记录,移除某个数后造成的recordrecordrecord数变化量.然后输出最优的即可. #include<bits/stdc++.h> #define LL long long #…
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 枚举删除第i个数字. 想想删掉这个数字后会有什么影响? 首先,如果a[i]如果是a[1..i]中最大的数字 那么record会减少1. 其次. 对于任意一个a[j],且i<j且a[i]是a[1..j]中最大的数字,且a[j]是a[1..j]中第二大的数字. 删掉a[i]后,a[j]都会成为一个record,即record数递增. 则我们可以预处理一下. 遍历a 对于a[i] 看看它是不是a[1..i]中第二小的数字. 那么标记c…
http://codeforces.com/problemset/problem/747/C 题意:有n台机器,q个操作.每次操作从ti时间开始,需要ki台机器,花费di的时间.每次选择机器从小到大开始,如果可以完成任务,那么输出id总和,否则输出-1. 思路:简单的模拟,注意如果不能完成任务,那么ser数组是不能更新的. #include <cstdio> #include <algorithm> #include <iostream> #include <cs…
A. Alyona and copybooks time limit per test: 1 second memory limit per test: 256 megabytes input: standard input output: standard output Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have eq…
A. Crazy Computer time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output ZS the Coder is coding on a crazy computer. If you don't type in a word for a c consecutive seconds, everything you typed…