寒假集训.Discrete-Function

Discrete Function

Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d
& %I64u

Submit Status

Description

There is a discrete function. It is specified for integer arguments from 1 to N (2 ≤ N ≤ 100000). Each value of the function is longint (signed long in C++). You have to find such two points of the function
for which all points between them are below than straight line connecting them and inclination of this straight line is the largest.

Input

There is an N in the first line. Than N lines follow with the values of the function for the arguments 1, 2, …, N respectively.

Output

A pair of integers, which are abscissas of the desired points, should be written into one line of output. The first number must be less then the second one. If it is any ambiguity your program should write the pair with the smallest
first number.

Sample Input

input output
3
2
6
4
1 2

数组一开始开的不够大Runtime error (access violation)了。

时间: 2024-10-01 07:25:32

寒假集训.Discrete-Function的相关文章

Ural 1010. Discrete Function

1010. Discrete Function Time limit: 1.0 secondMemory limit: 64 MB There is a discrete function. It is specified for integer arguments from 1 to N (2 ≤ N≤ 100000). Each value of the function is longint (signed long in C++). You have to find such two p

CSU-ACM寒假集训选拔-入门题

CSU-ACM寒假集训选拔-入门题 仅选择部分有价值的题 J(2165): 时间旅行 Description 假设 Bobo 位于时间轴(数轴)上 t0 点,他要使用时间机器回到区间 (0,?h] 中. 当 Bobo 位于时间轴上 t 点,同时时间机器有 c 单位燃料时,他可以选择一个满足 \(\lceil\frac{x}{h}\rceil\leq c\) 的非负整数 x, 那么时间机器会在 [0,?x]中随机整数 y,使 Bobo 回到 (t???y) 点,同时消耗 y 单位燃料. (其中 ?

寒假集训总结

这个寒假的集训吧,缺少了总结. 首先去了秦皇岛的几天还是挺不错的,但是人还是很懒散,没有每日做总结,导致以前会做的题目不会做.COME OJ上的视频也没有看完.秦皇岛开阔了眼界吧. 放寒假前的几天吧,都在聊天,唉,真的有时候会感到孤独... 只写了两场CF的所有题题解对的.(还缺178场) 之后回学校吧一个人在寝室就看看游戏直播的视频,嗯,挺荒废的. 寒假的收货吧,会了时间线段树,一些些STL,dp做了总结,分块+暴力的方法. 之后应该干什么呢,3月17校赛,3月底天梯,4月初浙大校赛,4月底浙

高一寒假集训总结

集训的一天 早读改前一天晚上没过的题. 上午学新课,开新的一套题,学模版优化模版.前半段总是没睡醒,将近中午时效率是一天中最高的.一般不大讨论. 下午继续做题,效率也比较高.讨论比上午多. 晚上思路很乱,而且一般都是做到一套题的后几道,进程缓慢,有些错误往往要到第二天早上才能想通. 集训之最 最有感触的一道题:家谱树.为了存人名现学关联式容器,发现大家课下确实学了不少东西,开学之后要拿更多时间读奥赛书,自学一些内容. 最佩服的一种解法:王超星的挖水井.这道题我做了很久,还是没能解决.请教王超星的

寒假集训第二场

整理人:贺振原 A - Generous Kefa (1) 马鸿儒 (2) 朱远迪 B - Godsend (1) 马鸿儒 (2) 朱远迪 C - Leha and Function D - Leha and another game about graph E - New Year and Ancient Prophecy F - New Year and Days (1) 马鸿儒 (2) 朱远迪 G - New Year and Domino H - New Year and Old Pro

寒假集训日志(二)——最小生成树,拓扑排序,欧拉回路,连通路

今天学的内容挺多的. (一)首先说最小生成树,两种算法: 1.Kruskal算法( 将边排序,然后再选,关键在于检查是否连通,使用并查集) 2.Prim算法(使用点集,有点类似与最短路的算法) 第一题是并查集算法的使用: A - The Suspects Time Limit:1000MS     Memory Limit:20000KB     64bit IO Format:%I64d & %I64u Submit Status Description 严重急性呼吸系统综合症( SARS),

(寒假集训)Roadblock(最短路)

Roadblock 时间限制: 1 Sec  内存限制: 64 MB提交: 9  解决: 5[提交][状态][讨论版] 题目描述 Every morning, FJ wakes up and walks across the farm from his house to the barn.  The farm is a collection of N fields (1 <= N <= 250) connected by M bidirectional pathways (1 <= M

(寒假集训)Mooo Moo (完全背包)

Mooo Moo 时间限制: 1 Sec  内存限制: 64 MB提交: 5  解决: 4[提交][状态][讨论版] 题目描述 Farmer John has completely forgotten how many cows he owns!  He is too embarrassed to go to his fields to count the cows, since he doesn't want the cows to realize his mental lapse.  Ins

(寒假集训)Watering the Fields (最小生成树)

Watering the Fields 时间限制: 1 Sec  内存限制: 64 MB提交: 26  解决: 10[提交][状态][讨论版] 题目描述 Due to a lack of rain, Farmer John wants to build an irrigation system to send water between his N fields (1 <= N <= 2000). Each field i is described by a distinct point (x