B
来源:互联网 发布:联通申请开通80端口 编辑:程序博客网 时间:2024/04/19 17:58
'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
题意:问有最长上升子序列长度;
思路:模板。。
下面附上代码:
#include<bits/stdc++.h>#define INF 0x3f3f3f3fusing namespace std;const int M=40010;int dp[M],a[M];int main(){int n,p;cin>>n;while(n--){cin>>p;for(int i=0;i<p;i++){cin>>a[i];dp[i]=INF;}for(int i=0;i<p;i++)*lower_bound(dp,dp+p,a[i])=a[i];printf("%d\n",lower_bound(dp,dp+p,INF)-dp);}return 0;}
阅读全文
0 0
- b
- b
- b
- //b
- B
- b
- B
- B
- B
- B
- b
- B
- B
- B
- B
- B
- B
- b
- jmeter jdbc无法通过IP连接到mysql解决方案
- C标准库之零:C标准库概述
- mysql省市区信息表
- 猜字小游戏
- python练习(六)
- B
- Java设计模式——单例模式
- sublime text 3 ,Package Control:There are no packages available for installation解决办法
- 多线程之静态同步函数/方法
- WebSocket使用教程
- cocos2d-js与android互相调用
- HNUST 1520: 压缩编码
- find the most comfortable road-并查集带权
- 【工具】在这里你能看到intellj(idea)的源码