https://codeforces.com/contest/1174/problem/A

题解:

1、排序;

2、判断前面n个和后面n个是否相同,相同-1;

/*
*@Author:   STZG
*@Language: C++
*/
#include <bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<cstring>
#include<cstdio>
#include<string>
#include<vector>
#include<bitset>
#include<queue>
#include<deque>
#include<stack>
#include<cmath>
#include<list>
#include<map>
#include<set>
//#define DEBUG
#define RI register int
#define endl "\n"
using namespace std;
typedef long long ll;
//typedef __int128 lll;
const int N=100000+10;
const int M=100000+10;
const int MOD=1e9+7;
const double PI = acos(-1.0);
const double EXP = 1E-8;
const int INF = 0x3f3f3f3f;
int t,n,m,k,p,l,r,u,v;
int ans,cnt,flag,temp,sum1,sum2;
int a[N];
char str;
struct node{};
int main()
{
#ifdef DEBUGfreopen("input.in", "r", stdin);//freopen("output.out", "w", stdout);
#endif//ios::sync_with_stdio(false);//cin.tie(0);//cout.tie(0);//scanf("%d",&t);//while(t--){scanf("%d",&n);for(int i=1;i<=2*n;i++)scanf("%d",&a[i]);sort(a+1,a+2*n+1);for(int i=1;i<=n;i++)sum1+=a[i],sum2+=a[i+n];;if(sum1==sum2){cout<<-1<<endl;}else{for(int i=1;i<=2*n;i++)printf("%d%c",a[i]," \n"[i==2*n]);}//}#ifdef DEBUGprintf("Time cost : %lf s\n",(double)clock()/CLOCKS_PER_SEC);
#endif//cout << "Hello world!" << endl;return 0;
}

Ehab Fails to Be Thanos相关推荐

  1. Codeforces Round #563 (Div. 2)/CF1174

    Codeforces Round #563 (Div. 2)/CF1174 CF1174A Ehab Fails to Be Thanos 其实就是要\(\sum\limits_{i=1}^n a_i ...

  2. GitHub有趣分享:Thanos(灭霸命令)

    Thanos.sh是一个开源的个灭霸命令,可随机删除电脑上一半文件.不知道这个命令有多少人执行过!? GitHub地址:https://github.com/hotvulcan/Thanos.sh P ...

  3. Codeforces 862B - Mahmoud and Ehab and the bipartiteness

    862B - Mahmoud and Ehab and the bipartiteness 思路:先染色,然后找一种颜色dfs遍历每一个点求答案. 代码: #include<bits/stdc+ ...

  4. Codeforces Round #649 (Div. 2)C. Ehab and Prefix MEXs[排列的构造]

    C. Ehab and Prefix MEXs 题目大意: 解题思路:题目说保证a数组是非递减的,那么如果某位置a[i]!=a[i−1]a[i]!=a[i-1]a[i]!=a[i−1]那么这个位置ii ...

  5. mysql删除有外链索引数据,Cannot delete or update a parent row: a foreign key constraint fails 问题的解决办法

    mysql删除有外链索引数据,Cannot delete or update a parent row: a foreign key constraint fails 问题的解决办法 参考文章: (1 ...

  6. Py_Initialize fails - unable to load the file system codec

    Py_Initialize fails - unable to load the file system codec https://stackoverflow.com/questions/56947 ...

  7. 关于mysql数据库的外键插入报错:Cannot add or update a child row: a foreign key constraint fails,完整性问题

    关于mysql的外键插入报错:Cannot add or update a child row: a foreign key constraint fails..... 首先确定sql语句的正确 然后 ...

  8. 一文详解 Prometheus 的高可用方案:Thanos

    点击上方"朱小厮的博客",选择"设为星标" 后台回复"书",获取 背景 在高可用 prometheus:问题集锦文章中有简单提到 Prome ...

  9. D:Ehab the Xorcist

    或许更好的阅读体验 Ehab the Xorcist 思路 刚看时确实是一脸懵,最怕的就是这种构造题了,然后细想好像能写啊. 判断不可行的条件,只有两种情况: 一.v<uv < uv< ...

最新文章

  1. FortiGate基本信息
  2. 颜色空间模型(HSV\LAB\RGB\CMYK)
  3. mysql里的ibdata1文件
  4. 三元一次方程组步骤_[七年级网上课堂]8.4 三元一次方程组
  5. Python 如何优雅的将数字转化为时间格式
  6. 100 计算机网络概述小结
  7. .NET : 如何理解字符串和它的字节表现形式
  8. Autobook中文版(七)—9.一个小的GNU Autotools项目
  9. 贺利坚老师汇编课程37笔记:把六个字符串里的头一个字母改写成大写字母
  10. linux/windows eclipse远程调试 c/c++程序
  11. 如何在arcmap引用谷歌数据
  12. 电脑数据传输哪款软件好用?
  13. 盘点一款黑客必备的强大网络工具集——netwox
  14. “中华酷联米”第一阵营形成 小米梦如何继续
  15. 通过调用百度生成短连接API接口,将长链接转换成短链接,并且生成短网址并返回,用户可以通过短连接访问,然后浏览器会解析跳转至长链接地址,有效的解决用户修改url后面的参数
  16. js批量生成条形码制作前端标签打印工具
  17. 来看一场开发者大会,缘何引来千人盛况
  18. 手机读卡但显示无服务器,手机不读卡了怎么修复
  19. 【转载】CDS view自学系列
  20. 对Vuejs框架“渐进式”的理解

热门文章

  1. python基本随机生成函数_Python学习笔记(三):随机生成函数方法
  2. NLP word2vec 计算优化
  3. python graphql query返回一组字典数据_Python的sqlalchemy使用原生sql查询如何返回字典形式的数组?...
  4. hashset去重原理_Java之HashSet,Linkedset常用功能以及介绍
  5. android调用另一app的xml,Android 7.0+调用其他App打开文件
  6. python的本质,讨论 - 廖雪峰的官方网站
  7. sql 转html 中文乱码问题,SqlServer中文乱码问题的解决方法
  8. 固态硬盘量产工具_机械硬盘Q1出货量大降,电脑硬盘榜单出炉
  9. 群晖218J安装mysql_ds216(群晖218j可以换内存吗)
  10. 八十九、常见的圣杯布局和双飞翼布局