ural 1904(超级难读懂的题意)
2013-05-23 08:54
232 查看
题意太难读懂。 读懂了就是水题了
E - The Lessons of the Past
Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u
Submit Status Practice URAL 1904
Description
It was the middle of the 23rd century. Alien creatures suddenly came out from hyperspace and attacked the Twenty-fifth colonization mission just when all its members gathered in a concert of one of the most popular singers in the whole Galaxy. Nearly a third of all mission members died during the ensuing panic and chaos.
Since then control of hyperspace has become one of the highest priorities of the Defense Forces. Automatic drones with hyperspace field vibration amplitude sensors were sent to the farthest corners of the inhabited part of the Galaxy. However, collecting data from them turned out to be a quite complicated technical problem. The point is that a huge amount of energy is required to transmit data at such distances without distortion. Even the usage of intermediary retransmitters doesn’t improve the situation much. However, engineers managed to find a sufficiently elegant solution. The retransmitter sends not the measured value, but an absolute value of the difference between the measured value and some reference value, which is imprinted in the memory of this retransmitter. These reference numbers are chosen in such a way that for the normal vibration level detected by sensor the final retransmitter in chain should send a number that is close to zero. So, when the final retransmitter sends the number that is strictly greater than one, the hyperspace disturbance is assumed to have happened. Security experts are interested how reliable the system of k retransmitters is, and what range of sensor readings will be interpreted as a calm state of hyperspace field. You are delegated to study this question.
Input
The first line contains an integer k that is the total number of retransmitters (1 ≤ k ≤ 10). The second line contains integers a1, …, ak that are the reference values recorded in the memory of retransmitters in the order the signal follows from the hyperspace field sensor to the receiver on the scout ship (−1000 ≤ ai ≤ 1000).
Output
In the first line output the integer n that is the amount of segments in answer. In the i'th of the following n lines output integers li ≤ ri that are the bounds of the i'th segment. The segments must be output in the ascending order of coordinates and without mutual intersections.
Sample Input
E - The Lessons of the Past
Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u
Submit Status Practice URAL 1904
Description
It was the middle of the 23rd century. Alien creatures suddenly came out from hyperspace and attacked the Twenty-fifth colonization mission just when all its members gathered in a concert of one of the most popular singers in the whole Galaxy. Nearly a third of all mission members died during the ensuing panic and chaos.
Since then control of hyperspace has become one of the highest priorities of the Defense Forces. Automatic drones with hyperspace field vibration amplitude sensors were sent to the farthest corners of the inhabited part of the Galaxy. However, collecting data from them turned out to be a quite complicated technical problem. The point is that a huge amount of energy is required to transmit data at such distances without distortion. Even the usage of intermediary retransmitters doesn’t improve the situation much. However, engineers managed to find a sufficiently elegant solution. The retransmitter sends not the measured value, but an absolute value of the difference between the measured value and some reference value, which is imprinted in the memory of this retransmitter. These reference numbers are chosen in such a way that for the normal vibration level detected by sensor the final retransmitter in chain should send a number that is close to zero. So, when the final retransmitter sends the number that is strictly greater than one, the hyperspace disturbance is assumed to have happened. Security experts are interested how reliable the system of k retransmitters is, and what range of sensor readings will be interpreted as a calm state of hyperspace field. You are delegated to study this question.
Input
The first line contains an integer k that is the total number of retransmitters (1 ≤ k ≤ 10). The second line contains integers a1, …, ak that are the reference values recorded in the memory of retransmitters in the order the signal follows from the hyperspace field sensor to the receiver on the scout ship (−1000 ≤ ai ≤ 1000).
Output
In the first line output the integer n that is the amount of segments in answer. In the i'th of the following n lines output integers li ≤ ri that are the bounds of the i'th segment. The segments must be output in the ascending order of coordinates and without mutual intersections.
Sample Input
input | output |
---|---|
3 0 4 2 | 4 -7 -5 -3 -1 1 3 5 7 |
#include <stdio.h> #include <string.h> #include <math.h> #include <algorithm> #include <iostream> using namespace std; int mark[200100]; struct node { int x,y; }edge[1010000]; int g[20]; int n; int fuc(int x) { int tmp=x; for(int i=1;i<=n;i++) { tmp=tmp-g[i]; if(tmp<0) tmp*=-1; } if(tmp<=1) return 1; else return 0; } int main() { while(~scanf("%d",&n)) { int cnt=0; memset(mark,0,sizeof(mark)); memset(edge,0,sizeof(edge)); for(int i=1;i<=n;i++) { scanf("%d",&g[i]); } /* for(int i=-10000;i<=10000;i++) { if( fuc(i) ) { int j=i+1; while(fuc(j)) { j++; } edge[cnt].x=i; edge[cnt].y=j-1; cnt++; i=j; } } printf("%d\n",cnt); for(int i=0;i<cnt;i++) printf("%d %d\n",edge[i].x,edge[i].y); */ /////////// cnt=0; for(int i=-20000;i<=20000;i++) { if(fuc(i)) { mark[i+20000]=1; } } int flag=0; int b=0,d=0; for(int i=0;i<=40220;i++) { if(mark[i]==1&&flag==0) { flag=1; b=i; } else { if(mark[i]==0&&flag==1) { flag=0; d=i-1; edge[cnt].x=b-20000; edge[cnt].y=d-20000; cnt++; } } } printf("%d\n",cnt); for(int i=0;i<cnt;i++) printf("%d %d\n",edge[i].x,edge[i].y); } return 0; }
相关文章推荐
- HDU 4930 Fighting the Landlords (超级暴力+读懂题意)
- [Swust OJ 188]--异面空间(读懂题意很重要)
- Assistance Required hdu 1216 读懂题意很重要 =_=\\
- ZOJ 1205题解本来是一道大数运算水题,可是却纠结了很久,原因是没能真正读懂题意,要求的计算必须是一一对应输出即使前面出现几个0最后也要把前面的0输出,看别人用C++自己还是两个都提交了结果还是C占的内存少。
- 超级干货 :一文读懂大数据处理框架
- hdu--2523--读懂题意....
- 栈的利用,这题主要读懂题意
- 超级干货 :一文读懂贝叶斯分类算法(附学习资源)
- URAL 1069. Prufer Code 读懂题意逆推模拟
- URAL 2021 Scarily interesting! (贪心+题意)
- 超级干货 :一文读懂LinkedIn个性化推荐模型及建模原理
- 超级干货 :一文读懂人工神经网络学习原理
- hdu 4956 Poor Hanamichi(BC.R#5) 读懂了题意就是水题/坑- -比赛中居然没有过
- UVA11624 Fire! 两次BFS 读懂题意很重要
- URAL 1718. Rejudge 题意讲解
- Educational Codeforces Round 28 A. Curriculum Vitae(读懂题意后的暴力水题)
- ural 1165 subnumber ------猥琐的超级大繁题
- ural 1170 desert
- 关于友善之臂mini2440串口接超级终端输入显示乱码问题的解决方法
- URAL 1297 后缀数组+RMQ求串的最长回文子串