小工具知识网

当前位置: 首页 > 行业知识 > Codeforces Round 450 (Div. 2) C. Remove Extra One

行业知识

Codeforces Round 450 (Div. 2) C. Remove Extra One

2026-10-28 10:54:00 来源:互联网转载

Remove Extra One

time limit per test: 2 second memindex.php/tags-1038.html" >ory limit per test: 256 megabytes input: standard input output: standard output

You are given a permutation p p p of length n n n. Remove one element from permutation to make the number of records the maximum possible.

We remind that in a sequence of numbers a 1 , a 2 , … , a k a_1,a_2,\dots,a_k a1​,a2​,…,ak​ the element a i a_i ai​ is a record if for every integer j j j ( 1   ≤   j   p[mx[0]]) { // 是否为最大值 mid[i]--; mx[1] = mx[0]; mx[0] = i; } else if (mx[1] == -1 or p[i] > p[mx[1]]) { // 是否仅小于最大值 mid[mx[0]]++; mx[1] = i; } } for (int i = 0; i mid[ans] or (mid[i] == mid[ans] and p[i]

上一篇:【C++】万字详解IO流(输入输出流+文件流+字符串流)

下一篇:织梦CMS缩略图快速更换指南,轻松上手,一步到位的实用教程!