A. Little Elephant and Function

  • 逆推。

B. Little Elephant and Numbers

  • \(O(\sqrt n)\)枚举约数。

C. Little Elephant and Problem

  • 排序后对应不相等的位置为2,且两数交换。

D. Little Elephant and Array

  • 离线+分块。

E. Little Elephant and Shifts

  • 每个数单独考虑。
  • 假设\(x\)在数组\(a\)的位置\(i\),在数组\(b\)的位置\(j\),且\(i \le j\),则从\(p_1\)到\(p_n\)对应的距离为\[j - i, j - i - 1, \cdots,1, 0, 1,\cdots, i-1, n-i, \cdots, j-i+1\]分成两个递减,一个递增区间。
  • 考虑\(p_1\)到\(p_{j-i+1}\)这个区间,第\(k\)个位置的值可以表示成\[d_k=d_1-(k-1)=(d_1+1)-k\]根据题意,要在所有方案中取\[\min{d_k}=\min{(d_1+1)}-k,d_1+1-k\ge 0\]这个可以用优先队列维护。
  • 其余两个单调区间也是类似做法。

Codeforces Round #136 (Div. 2)的更多相关文章

  1. Codeforces Round #136 (Div. 1)C. Little Elephant and Shifts multiset

    C. Little Elephant and Shifts Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/pro ...

  2. Codeforces Round #136 (Div. 1) B. Little Elephant and Array

    B. Little Elephant and Array time limit per test 4 seconds memory limit per test 256 megabytes input ...

  3. Codeforces Round #366 (Div. 2) ABC

    Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate ...

  4. Codeforces Round #354 (Div. 2) ABCD

    Codeforces Round #354 (Div. 2) Problems     # Name     A Nicholas and Permutation standard input/out ...

  5. Codeforces Round #368 (Div. 2)

    直达–>Codeforces Round #368 (Div. 2) A Brain’s Photos 给你一个NxM的矩阵,一个字母代表一种颜色,如果有”C”,”M”,”Y”三种中任意一种就输 ...

  6. cf之路,1,Codeforces Round #345 (Div. 2)

     cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅.....   ...

  7. Codeforces Round #279 (Div. 2) ABCDE

    Codeforces Round #279 (Div. 2) 做得我都变绿了! Problems     # Name     A Team Olympiad standard input/outpu ...

  8. Codeforces Round #262 (Div. 2) 1003

    Codeforces Round #262 (Div. 2) 1003 C. Present time limit per test 2 seconds memory limit per test 2 ...

  9. Codeforces Round #262 (Div. 2) 1004

    Codeforces Round #262 (Div. 2) 1004 D. Little Victor and Set time limit per test 1 second memory lim ...

随机推荐

  1. 站在K2角度审视流程--任务的独占与释放

    应用场景一:某件事情由A.B两人(或者更多人)完成,任务开始后,两人随时可以处理任务,只需有一人处理完成,此事情即可结束. 应用场景二:某件事情由A.B两人(或者更多人)完成,任务开始后,两人随时可以 ...

  2. SQL学习心得(转)

    http://www.cnblogs.com/lyhabc/p/3732942.html

  3. 今年plan,做好四件事情

    写代码, 写博客, 学英语, 锻炼身体.

  4. [安卓]我的安卓开发FAQ

    1.什么是ADT: android官方解释是:ADT (Android Developer Tools) is a plugin for Eclipse that provides a suite o ...

  5. jQuery之$('#id')和$('#'+id)

    最近在项目中使用$('#id')时,发现拿到的元素怎么都是空元素,(前提是id是作为变量),纠结了好一阵,使用fire bug也调试了半天终于发现原来$('#id')是使用整体来匹配,即查找id 为i ...

  6. HD OJ2023

    #include "stdio.h"double stu[60],cla[10];int a[60][60];int main(){ int n,m,i,number,j; whi ...

  7. device framework(设备框架)

    Table A-1  Device frameworks Name First available Prefixes Description Accelerate.framework 4.0 cbla ...

  8. .a包生成64位

    ./configure  CC="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain ...

  9. 2、网页制作Dreamweaver(图片热点、frameset框架)

    图片热点 1.方法: <img  usemap="名字"> <map name="名字"> <area shape="r ...

  10. Unity3D ShaderLab 各向异性高光

    Unity3D ShaderLab 各向异性高光 各向异性时一种模拟物体表面沟槽方向性的高光反射类型,它会修改或延伸垂直方向上的高光.当我们想模拟金属拉丝高光的时候,它非常适合.下面就一步一步实现. ...