【CS Round #46 (Div. 1.5) C】Set Subtraction
【链接】h在这里写链接
【题意】
【题解】
【错的次数】
【反思】
【代码】
/* */
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <cstdlib>
#include <cmath>
#include <bitset>
using namespace std;
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define LL long long
#define rep1(i,a,b) for (int i = a;i <= b;i++)
#define rep2(i,a,b) for (int i = a;i >= b;i--)
#define mp make_pair
#define pb emplace_back
#define fi first
#define se second
#define ld long double
#define ms(x,y) memset(x,y,sizeof x)
#define ri(x) scanf("%d",&x)
#define rl(x) scanf("%lld",&x)
#define rs(x) scanf("%s",x)
#define rf(x) scnaf("%lf",&x)
#define oi(x) printf("%d",x)
#define ol(x) printf("%lld",x)
#define oc putchar(' ')
#define os(x) printf(x)
#define all(x) x.begin(),x.end()
#define Open() freopen("F:\\rush.txt","r",stdin)
#define Close() ios::sync_with_stdio(0)
#define sz(x) ((int) x.size())
#define ld long double typedef pair<int,int> pii;
typedef pair<LL,LL> pll; //mt19937 myrand(time(0));
//int get_rand(int n){return myrand()%n + 1;}
const int dx[9] = {0,1,-1,0,0,-1,-1,1,1};
const int dy[9] = {0,0,0,-1,1,-1,1,-1,1};
const double pi = acos(-1.0);
const int N = 1e3; int n,a[2*N+10];
vector <int> v;
bool bo[2*N+10]; bool ok(int x){
int j = 0;
rep1(i,1,2*n)
if (!bo[i]){
bo[i] = true;
bool ok = false;
while (1){
if (j > 2*n) break;
if (a[j]==a[i]+x){
ok = true;
bo[j] = true;
v.pb(a[j]);
j++;
break;
}else j++;
}
if (!ok) return false;
}
return true;
} int main(){
//Open();
//Close();
ri(n);
rep1(i,1,2*n)
ri(a[i]);
sort(a+1,a+1+2*n);
rep1(i,2,2*n)
if (a[i]!=a[1]){
ms(bo,0);
bo[1] = bo[i] = true;
v.clear();
v.pb(a[i]);
if (ok(a[i]-a[1])){
oi(a[i]-a[1]),puts("");
rep1(i,1,n){
oi(v[i-1]);
if (i==n)
puts("");
else
oc;
}
return 0;
}
}
puts("-1");
return 0;
}
【CS Round #46 (Div. 1.5) C】Set Subtraction的更多相关文章
- 【CS Round #46 (Div. 1.5) E】Ultimate Orbs
[链接]链接 [题意] n个人从左到右站在一条直线上.每个人都有一个能力值g[i],然后每个人可以将相邻的一个人打败. 然后它的能力值能够增加相应的能力值(就是打败了的那个人的能力值). A能够打败B ...
- 【CS Round #46 (Div. 1.5) B】Letters Deque
[链接]h在这里写链接 [题意] 让你把一个正方形A竖直或水平翻转. 问你翻转一次能不能把A翻转成B [题解] 有说一定要恰好为1次. 并不是说A和B相同就一定不行. [错的次数] 2 [反思] 自己 ...
- 【CS Round #46 (Div. 1.5) A】Letters Deque
[链接]h在这里写链接 [题意] 在这里写题意 [题解] string类模拟 [错的次数] 0 [反思] 在这了写反思 [代码] /* */ #include <cstdio> #incl ...
- 【CS Round #36 (Div. 2 only) A】Bicycle Rental
[题目链接]:https://csacademy.com/contest/round-36/task/bicycle-rental/ [题意] 让你从n辆车中选一辆车; 每一辆车有3个属性 1.到达车 ...
- 【CS Round #37 (Div. 2 only) D】Reconstruct Graph
[Link]:https://csacademy.com/contest/round-37/task/reconstruct-graph/statement/ [Description] 给你一张图; ...
- 【CS Round #37 (Div. 2 only) B】Group Split
[Link]:https://csacademy.com/contest/round-37/task/group-split/ [Description] 让你把一个数分成两个数a.b的和; (a,b ...
- 【CS Round #37 (Div. 2 only) A】Boring Number
[Link]:https://csacademy.com/contest/round-37/task/boring-number/ [Description] 让你找离平均数最近的一个数的下标; [S ...
- 【CS Round #39 (Div. 2 only) D】Seven-segment Display
[Link]:https://csacademy.com/contest/round-39/task/seven-segment-display/ [Description] 0..9各自有一个数字, ...
- 【CS Round #39 (Div. 2 only) C】Reconstruct Sum
[Link]:https://csacademy.com/contest/round-39/task/reconstruct-sum/ [Description] 给你一个数字S; 让你找有多少对A, ...
随机推荐
- file---探测给定文件的类型
file命令用来探测给定文件的类型.file命令对文件的检查分为文件系统.魔法幻数检查和语言检查3个过程. 语法 file(选项)(参数) 选项 -b:列出辨识结果时,不显示文件名称: -c:详细显示 ...
- Mysql学习总结(6)——MySql之ALTER命令用法详细解读
MySql语法中Alter命令的用法,这是一个用法比较多的语法,而且功能还是很强大的. [sql] view plaincopy USE learning;(自己要提前建好) CREATE TABLE ...
- CSUOJ 1637 Yet Satisfiability Again!
1637: Yet Satisfiability Again! Time Limit: 5 Sec Memory Limit: 128 MB Description Alice recently s ...
- Springboot分布式限流实践
高并发访问时,缓存.限流.降级往往是系统的利剑,在互联网蓬勃发展的时期,经常会面临因用户暴涨导致的请求不可用的情况,甚至引发连锁反映导致整个系统崩溃.这个时候常见的解决方案之一就是限流了,当请求达到一 ...
- POJ——T3160 Father Christmas flymouse
Time Limit: 1000MS Memory Limit: 131072K Total Submissions: 3496 Accepted: 1191 缩点,然后每个新点跑一边SPFA ...
- 讲的好,php后端模式,php-fpm以及php-cgi, fast-cgi,以及与nginx的关系
关于cgi是什么,fast-cgi是什么,php-cgi是什么,fast-cgi是什么,下面这篇讲的很清楚: https://segmentfault.com/q/1010000000256516 另 ...
- MySQL架构组成之逻辑模块组成
MySQL 能够看成是二层架构 第一层SQL Layer.包含权限推断.sql 解析.运行计划优化,query cache 的处理等等. 第二层存储引擎层(Storage Engine Lay ...
- jQuery11 data() : 数据缓存
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content ...
- Thinkphp的 is null 查询条件是什么,以及exp表达式如何使用
Thinkphp的 is null 查询条件是什么,以及exp表达式如何使用 一.总结 一句话总结:$map['name'] = array('exp','is null'); 1.is null判断 ...
- html5中的空格符
html5中的空格符 1,Html中空格 不断行的空白(1个字符宽度) 半个空白(1个字符宽度) 一个空白(2个字符宽度) 窄空白(小于1个字符宽度) 2,Css ...