HDU6424 Rikka with Time Complexity
HDU6424 Rikka with Time Complexity
数学题~(真的数学题)
#include <bits/stdc++.h>
#define mp(_,__) make_pair(_,__) using namespace std;
int T,n,m;
int a[],b[];
pair <int,int> a1,a2,b1,b2;
pair <pair<int,int>,pair<int,int> > A,B;
int main(){
scanf("%d",&T);
while(T--)
{
scanf("%d%d",&n,&m);
memset(a,0x3f,sizeof(a));
memset(b,0x3f,sizeof(b));
for (int i = ;i < n;++i) scanf("%d",a+i);
for (int i = ;i < m;++i) scanf("%d",b+i);
a1 = mp(a[]+,0x3f3f3f3f),b1 = mp(b[]+,0x3f3f3f3f);
a[]++;b[]++;
if (a[] > a[]) swap(a[],a[]);
if (b[] > b[]) swap(b[],b[]);
a2 = mp(a[],a[]),b2 = mp(b[],b[]);
if (a1 > a2) swap(a1,a2);
if (b1 > b2) swap(b1,b2);
A = make_pair(a1,a2),B = make_pair(b1,b2);
if ( A == B) puts("");
else if (A > B) puts("-1");
else puts("");
}
return ;
}
HDU6424 Rikka with Time Complexity的更多相关文章
- 杭电多校第九场 hdu6424 Rikka with Time Complexity 数学
Rikka with Time Complexity Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 524288/524288 K ( ...
- 2018 Multi-University Training Contest 9 Solution
A - Rikka with Nash Equilibrium 题意:构造一个$n * m$的矩阵,使得$[1, n * m]$ 中每个数只出现一次,并且纳什均衡只出现一次. 思路:从大到小的放置,每 ...
- Instant Complexity - POJ1472
Instant Complexity Time Limit: 1000MS Memory Limit: 10000K Description Analyzing the run-time comple ...
- Runtime Complexity of .NET Generic Collection
Runtime Complexity of .NET Generic Collection I had to implement some data structures for my compu ...
- Examples of complexity pattern
O(1):constant - the operation doesn't depend on the size of its input, e.g. adding a node to the tai ...
- 2016暑假多校联合---Rikka with Sequence (线段树)
2016暑假多校联合---Rikka with Sequence (线段树) Problem Description As we know, Rikka is poor at math. Yuta i ...
- 空间复杂度是什么?What does ‘Space Complexity’ mean? ------geeksforgeeks 翻译
这一章比较短! 空间复杂度(space complexity)和辅助空间(auxiliary space)经常混用,下面是正确的辅助空间和空间复杂度的定义 辅助空间:算法需要用到的额外或者暂时的存储空 ...
- 三部曲二(基本算法、动态规划、搜索)-1004-Instant Complexity
Instant Complexity Time Limit : 2000/1000ms (Java/Other) Memory Limit : 20000/10000K (Java/Other) ...
- hdu.5203.Rikka with wood sticks(数学推导:一条长度为L的线段经分割后可以构成几种三角形)
Rikka with wood sticks Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/O ...
随机推荐
- 在layui中,新的页面怎么获取另一个页面传过来的数据,并可以对数据进行判断,layui中的后台分页(table)。
例如:打开一个新页面的同时,传数据. layer.open({ type: 2, title: '新增项目', shadeClose: false, shade: [0.3], maxmin: tru ...
- log4net 配置文件配置方法
转自:http://www.dozer.cc/2013/06/log4net-config-file-order/ 最近把项目中所有的日志都改成了 log4net ,同事也蠢蠢欲动,用起了 log4n ...
- synchronized的底层实现原理
转自:http://www.cnblogs.com/paddix/p/5367116.html 如果对上面的执行结果还有疑问,也先不用急,我们先来了解Synchronized的原理,再回头上面的问题就 ...
- [Python3 练习] 007 简单的猜数字小游戏
题目:简单的猜数字小游戏 (1) 描述 程序随机生成一个数字,玩家用键盘输入所猜数字,在规定次数内猜对为胜. (2) 要求 程序随机生成一个 1 到 100 的自然数 有 7 次机会去猜 机会用尽之前 ...
- SpringMvc错误:HTTP Status 500 - Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: There is n
HTTP Status 500 - Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemExc ...
- [2019CCPC网络赛][hdu6704]K-th occurrence(后缀数组&&主席树)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6704 题意为查询子串s[l...r]第k次出现的位置. 写完博客后5分钟的更新 写完博客才发现这份代码 ...
- HDU-2571 命运(搜索,我才不是为了插图呢!哼!)
看到这题其实感觉就是搜索题,广搜的话看讨论区里已经有人内存超限了,所以我选择了深搜,有两种思路,第一种是从起点出发,依次更新每一个格子的最大值,这样dp[n][m]就是最后的结果了,第二种是从起点试探 ...
- oracle学习笔记(四) DML数据控制语言和TCL 事务控制语言
DML 数据管理语言 Data manage language insert, update, delete以及select语句,不过,有人也把select单独出来,作为DQL 数据查询语言 data ...
- 零点.Net Core 接触
一.Program.cs类与Startup类 1.一切从Main开始,Main方法包含了是整个应用程序的入口 ASP.NET Core应用程序可以配置和启动主机(Host). 主机负责应用程序启动和生 ...
- 解决SVN异常 cleanup failed
winndows上偶尔使用SVN的时候就会整出一些有的没的问题,比如"cleanup failed to process the following paths previous opera ...