当前位置:网站首页>Merging of Shanzhai version [i]
Merging of Shanzhai version [i]
2022-04-23 15:44:00 【MC happy bitter little fear】
subject :
Title Description
Problem description
Coco and LeLe have a lot of game cards on hand , There are numbers on the cards , They sort their cards from small to large , Now they want to put their cards together , And also ensure that it is sorted from small to large . Because the number of cards may reach millions , And you have to merge the cards in a second , Now please help !
Input format
There are three lines .
first line : Two integers separated by spaces n and m, Number of cards representing cocoa and LeLe respectively ;
The second line :n An integer separated by a space , Indicates the number of cocoa cards from small to large ;
The third line :m An integer separated by a space , Indicates the number of Lele card from small to large ;
Output format
Just one line :n+m It's an integer , Space off , Indicates the number of the combined card from small to large .
sample input
3 4
3 5 7
1 3 4 6
sample output
1 3 3 4 5 6 7
Data range
n<=1000000,m<=1000000
The time set by the teacher for the beginning of this problem is 2 Sec, Ha ha ha , Violence directly 100 To get :
Definition a[2000010]
Then go straight to various individual sort Violent perfection .

But the teacher saw us operate so N, I changed the time to 1 Sec.
wawawaw, Suddenly tears poured down .
…
shua Code start
Got two “ The pointer ”( It's not here *x The pointer of ).
i,j;
Don't talk much , Code up :
#include <bits/stdc++.h>
using namespace std;
int a[1000010],b[1000010];
int main(){
int n,m;
cin>>n>>m;
for(int i=1;i<=n;i++)scanf("%d",&a[i]);
for(int j=1;j<=m;j++)scanf("%d",&b[j]);
int i=1,j=1;
for(int x=1;x<=n+m;x++){
if(a[i]>b[j])printf("%d ",a[i]),i++;
else printf("%d ",b[j]),j++;
}
return 0;
}
goodbye!!!
Shanzhai version merged 【 Next 】 Portal
版权声明
本文为[MC happy bitter little fear]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231531525307.html
边栏推荐
- Cookie&Session
- Go language, array, pointer, structure
- 2022年中国数字科技专题分析
- Upgrade MySQL 5.1 to 5.67
- ICE -- 源码分析
- 通過 PDO ODBC 將 PHP 連接到 MySQL
- 大厂技术实现 | 行业解决方案系列教程
- 幂等性的处理
- Code live collection ▏ software test report template Fan Wen is here
- API IX JWT auth plug-in has an error. Risk announcement of information disclosure in response (cve-2022-29266)
猜你喜欢

布隆过滤器在亿级流量电商系统的应用

Timing model: gated cyclic unit network (Gru)

Multitimer V2 reconstruction version | an infinitely scalable software timer

大厂技术实现 | 行业解决方案系列教程

MySQL Cluster Mode and application scenario

负载均衡器

APISIX jwt-auth 插件存在错误响应中泄露信息的风险公告(CVE-2022-29266)

C language --- string + memory function

Mobile finance (for personal use)

IronPDF for .NET 2022.4.5455
随机推荐
PHP PDO ODBC loads files from one folder into the blob column of MySQL database and downloads the blob column to another folder
提取不重复的整数
php函数
s16. One click installation of containerd script based on image warehouse
MetaLife与ESTV建立战略合作伙伴关系并任命其首席执行官Eric Yoon为顾问
Cap theorem
For examination
Basic concepts of website construction and management
APISIX jwt-auth 插件存在错误响应中泄露信息的风险公告(CVE-2022-29266)
贫困的无网地区怎么有钱建设网络?
ICE -- 源码分析
Best practices of Apache APIs IX high availability configuration center based on tidb
Accumulation of applet knowledge points
PHP 的运算符
【AI周报】英伟达用AI设计芯片;不完美的Transformer要克服自注意力的理论缺陷
单体架构系统重新架构
MySQL optimistic lock to solve concurrency conflict
基于 TiDB 的 Apache APISIX 高可用配置中心的最佳实践
c语言---字符串+内存函数
Deletes the least frequently occurring character in the string