CodeForces 840A - Leha and Function | Codeforces Round #429 (Div. 1)
/*
CodeForces 840A - Leha and Function [ 贪心 ] | Codeforces Round #429 (Div. 1)
A越大,B越小,越好
*/
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5+5;
int a[N], b[N], c[N], n;
int aa[N], bb[N];
bool cmp1(int x, int y) {
return a[x] > a[y];
}
bool cmp2(int x, int y) {
return b[x] < b[y];
}
int main()
{
scanf("%d", &n);
for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
for (int i = 1; i <= n; i++) scanf("%d", &b[i]);
for (int i = 1; i <= n; i++) aa[i] = bb[i] = i;
sort(aa+1, aa+n+1, cmp1);
sort(bb+1, bb+n+1, cmp2);
for (int i = 1; i <= n; i++) c[bb[i]] = a[aa[i]];
for (int i = 1; i < n; i++) printf("%d ", c[i]);
printf("%d\n", c[n]);
}
CodeForces 840A - Leha and Function | Codeforces Round #429 (Div. 1)的更多相关文章
- CodeForces 840B - Leha and another game about graph | Codeforces Round #429(Div 1)
思路来自这里,重点大概是想到建树和无解情况,然后就变成树形DP了- - /* CodeForces 840B - Leha and another game about graph [ 增量构造,树上 ...
- CodeForces 840C - On the Bench | Codeforces Round #429 (Div. 1)
思路来自FXXL中的某个链接 /* CodeForces 840C - On the Bench [ DP ] | Codeforces Round #429 (Div. 1) 题意: 给出一个数组, ...
- Codeforces Round #429 (Div. 2/Div. 1) [ A/_. Generous Kefa ] [ B/_. Godsend ] [ C/A. Leha and Function ] [ D/B. Leha and another game about graph ] [ E/C. On the Bench ] [ _/D. Destiny ]
PROBLEM A/_ - Generous Kefa 题 OvO http://codeforces.com/contest/841/problem/A cf 841a 解 只要不存在某个字母,它的 ...
- Codeforces Round #429 (Div. 2) 补题
A. Generous Kefa 题意:n个气球分给k个人,问每个人能否拿到的气球都不一样 解法:显然当某种气球的个数大于K的话,就GG了. #include <bits/stdc++.h> ...
- Codeforces Round #429 (Div. 2)
A. Generous Kefa One day Kefa found n baloons. For convenience, we denote color of i-th baloon as ...
- 【Codeforces Round #429 (Div. 2) C】Leha and Function
[Link]:http://codeforces.com/contest/841/problem/C [Description] [Solution] 看到最大的和最小的对应,第二大的和第二小的对应. ...
- 【CodeForces】841C. Leha and Function(Codeforces Round #429 (Div. 2))
[题意]定义函数F(n,k)为1~n的集合中选择k个数字,其中最小数字的期望. 给定两个数字集A,B,A中任意数字>=B中任意数字,要求重组A使得对于i=1~n,sigma(F(Ai,Bi))最 ...
- Codeforces Round #429 (Div. 2) - D Leha and another game about graph
Leha and another game about graph 题目大意:给你一个图,每个节点都有一个v( -1 , 0 ,1)值,要求你选一些边,使v值为1 的点度数为奇数,v值为0的度数为偶数 ...
- 【推导】【DFS】Codeforces Round #429 (Div. 1) B. Leha and another game about graph
题意:给你一张图,给你每个点的权值,要么是-1,要么是1,要么是0.如果是-1就不用管,否则就要删除图中的某些边,使得该点的度数 mod 2等于该点的权值.让你输出一个留边的方案. 首先如果图内有-1 ...
随机推荐
- linux程序设计--进程相关的各种ID
1.调用exec函数时,目标可执行文件没有设定设置用户id. 2.调用exec函数时,目标可执行文件设定设置用户id.
- RHadoop: REDUCE capability required is more than the supported max container capability in the cluster
I have not used RHadoop. However I've had a very similar problem on my cluster, and this problem see ...
- Foxmail7.2的账号密码的备份与恢复
1:备份: 1.0 找到Foxmail7.2的安装的位置,例如我的就是 D:\Program Files\Foxmail 7.2; 然后在路径下找到Storage文件夹然后备份里边的内容; 邮箱账号备 ...
- (七)lucene之中文检索和高亮显示以及摘要
前提:本章节使用lucene5.3.0版本,luke也是此版本的. 1.1 生成索引 package com.shyroke.lucene; import java.io.IOException; ...
- DSO missing from command line
最近项目正经历着一次更新,一系列编译工具都进行了大版本的升级,随时而来的是,原本正常编译的代码出现了大量的warning,最终编译失败,其 中一个问题困扰了比较长的时间,虽然fix的方法不难,但是一直 ...
- Linux 命令集锦
linux 一切从根开始,一切皆文件~ 让我们从一些命令开始了解吧 基本命令 man command:manual:查看命令帮助手册 ls:list:查看当前文件夹下的内容 -a 查看所有内容,包含 ...
- 数据结构与算法(周测2-AVL树)
判断题 1.The inorder traversal sequence of an AVL tree must be in sorted (non-decreasing) order. T ...
- vue中用解构赋值的方法引入组件
在一个组件中引入很多其他组件的时候会显得代码很臃肿,这个时候可以用es6的解构赋值的方法 在components中写入一个index.js文件 在该js文件中导出你想要引入的组件 再接着就可以在该组件 ...
- CVE-2019-0214: Apache Archiva arbitrary file write and delete on the server
CVE-2019-0214: Apache Archiva arbitrary file write and delete on the server Severity: Medium Vendor: ...
- Android获取设备唯一码
String uuid = ""; String serial = null; String m_szDevIDShort = "35" + Build.BOA ...