Bridging signals
来源:互联网 发布:上海易云网络 编辑:程序博客网 时间:2024/06/06 00:18
Oh no, they've done it again', cries the chief designer at the Waferland chip factory. Once more the routing designers have screwed up completely, making the signals on the chip connecting the ports of two functional blocks cross each other all over the place. At this late stage of the process, it is too
expensive to redo the routing. Instead, the engineers have to bridge the signals, using the third dimension, so that no two signals cross. However, bridging is a complicated operation, and thus it is desirable to bridge as few signals as possible. The call for a computer program that finds the maximum number of signals which may be connected on the silicon surface without rossing each other, is imminent. Bearing in mind that there may be housands of signal ports at the boundary of a functional block, the problem asks quite a lot of the programmer. Are you up to the task?
Figure 1. To the left: The two blocks' ports and their signal mapping (4,2,6,3,1,5). To the right: At most three signals may be routed on the silicon surface without crossing each other. The dashed signals must be bridged.
A typical situation is schematically depicted in figure 1. The ports of the two functional blocks are numbered from 1 to p, from top to bottom. The signal mapping is described by a permutation of the numbers 1 to p in the form of a list of p unique numbers in the range 1 to p, in which the i:th number pecifies which port on the right side should be connected to the i:th port on the left side.
Two signals cross if and only if the straight lines connecting the two ports of each pair do.
expensive to redo the routing. Instead, the engineers have to bridge the signals, using the third dimension, so that no two signals cross. However, bridging is a complicated operation, and thus it is desirable to bridge as few signals as possible. The call for a computer program that finds the maximum number of signals which may be connected on the silicon surface without rossing each other, is imminent. Bearing in mind that there may be housands of signal ports at the boundary of a functional block, the problem asks quite a lot of the programmer. Are you up to the task?
Figure 1. To the left: The two blocks' ports and their signal mapping (4,2,6,3,1,5). To the right: At most three signals may be routed on the silicon surface without crossing each other. The dashed signals must be bridged.
A typical situation is schematically depicted in figure 1. The ports of the two functional blocks are numbered from 1 to p, from top to bottom. The signal mapping is described by a permutation of the numbers 1 to p in the form of a list of p unique numbers in the range 1 to p, in which the i:th number pecifies which port on the right side should be connected to the i:th port on the left side.
Two signals cross if and only if the straight lines connecting the two ports of each pair do.
4642631510234567891018876543219589231746
3914算法:
这题只能用nlog(n)的方法过,其实就是求最长上升子序列,套用模板就好
#include <cstdio> #include <algorithm> #define INF 0x3f3f3f #define maxx 40000+10 using namespace std; int dp[maxx],a[maxx]; int main() { int n,i,j; int T;scanf("%d",&T); while(T--) { scanf("%d",&n); for(i=0;i<n;++i) { scanf("%d",&a[i]); dp[i]=INF; } for(i=0;i<n;++i) *lower_bound(dp,dp+n,a[i])=a[i];//把a[i]放进第一个大于等于a[i]的位置 printf("%d\n",lower_bound(dp,dp+n,INF)-dp);// 输出第一个INF的位置 } return 0; }
阅读全文
0 0
- Bridging signals
- Bridging signals
- Bridging signals
- Bridging signals
- Bridging signals
- Bridging signals
- Bridging Signals
- Bridging signals
- Bridging signals
- Bridging signals
- Bridging signals
- Bridging signals
- pku 1631 Bridging signals
- POJ 1631 Bridging signals
- PKU的Bridging Signals
- ZOJ 1986 Bridging Signals
- Bridging signals POJ 1631
- poj1631 Bridging signals
- CSS3-基本选择器
- win7安装Qt4.8.5 For Windows 最详细的教程,附带所有安装文件-- 转自zgj_today的csdn空间
- 深度学习入门---softmax回归 Python实现
- Ecology8二次开发:HTML表单添加值改变事件
- java中 servlet和jsp的概念及区别
- Bridging signals
- Mac磁盘空间不足
- 算法(3.1 符号表)
- 【socket】深入浅出讲解:php的socket通信
- If...Then...Else
- 泛型和数组以及Java是如何实现泛型的
- C#之入门总结_进程,线程_14
- 防止移动端点击输入框页面放大
- 基于连通域和投影结合的汉字切割