当前位置:网站首页>B - Bridging signals
B - Bridging signals
2022-06-26 13:08:00 【YJEthan】
Description
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.
Input
Output
Sample Input
4
6
4
2
6
3
1
5
10
2
3
4
5
6
7
8
9
10
1
8
8
7
6
5
4
3
2
1
9
5
8
9
2
3
1
7
4
6
Sample Output
3
9
1
4
#include<stdio.h>
int a[50050];
int dp[50058];
int search(int l,int r,int i)
{
int mid;
while(r>l)
{
mid=(l+r)/2;
if(dp[mid]>=a[i]) r=mid;
else l=mid+1;
}
return l;
}
int main()
{
int i,j,t,n;
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
dp[0]=a[0];
int top=0;
for(i=1;i<n;i++)
{
if(a[i]>dp[top])
{
dp[++top]=a[i];
}
else
{
dp[search(0,top,i)]=a[i];
}
}
printf("%d\n",top+1);
}
}
边栏推荐
- C structure: definition and example
- 倍福PLC基于CX5130实现数据的断电保持
- Dark horse notes - Common APIs
- processsing 函数random
- Record a phpcms9.6.3 vulnerability to use the getshell to the intranet domain control
- 体现技术深度(无法速成)
- 数字信号处理——线性相位型(Ⅰ、Ⅲ型)FIR滤波器设计(1)
- Summary of wechat applet test points
- Use the script to crawl the beautiful sentences of the sentence fan website and store them locally (blessed are those who like to excerpt!)
- Electron official docs series: References
猜你喜欢
![[esp32-c3][rt-thread] run RT-Thread BSP minimum system based on esp32c3](/img/4a/503240b332e3279047c438f1d9845e.png)
[esp32-c3][rt-thread] run RT-Thread BSP minimum system based on esp32c3

Beifu PLC passes MC_ Readparameter read configuration parameters of NC axis

自动化测试的局限性你知道吗?

Dark horse notes - Common APIs

ES6:迭代器
![P5733 [deep foundation 6. example 1] automatic correction](/img/34/081dbd805593a92a86c3081d6772e3.png)
P5733 [deep foundation 6. example 1] automatic correction
![[BSidesCF 2019]Kookie 1](/img/22/585d081668e67b8389a1b90aaebe9d.png)
[BSidesCF 2019]Kookie 1

外观模式(Facade)

P5733 【深基6.例1】自动修正

倍福PLC基于CX5130实现数据的断电保持
随机推荐
Word文档导出(使用固定模板)
倍福TwinCAT3实现CSV、TXT文件读写操作
. Net Maui performance improvement
Software testing - concept
HDU 3709 Balanced Number
Beifu PLC passes MC_ Readparameter read configuration parameters of NC axis
find及du -sh显示权限不够的解决方法
B - Bridging signals
sql 将数据表b字段值赋值到数据表a中某一列
Dark horse notes - Common APIs
倍福PLC选型--如何看电机是多圈绝对值还是单圈绝对值编码器
Explain C language 10 in detail (C language series)
H - Sumsets POJ 2229
Typescript
Machine learning notes - seasonality of time series
Stream learning record
C语言:练习题二
Appearance mode (facade)
详细讲解C语言10(C语言系列)
Adobe Acrobat prevents 30 security software from viewing PDF files or there are security risks