/*
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)的更多相关文章

  1. CodeForces 840B - Leha and another game about graph | Codeforces Round #429(Div 1)

    思路来自这里,重点大概是想到建树和无解情况,然后就变成树形DP了- - /* CodeForces 840B - Leha and another game about graph [ 增量构造,树上 ...

  2. CodeForces 840C - On the Bench | Codeforces Round #429 (Div. 1)

    思路来自FXXL中的某个链接 /* CodeForces 840C - On the Bench [ DP ] | Codeforces Round #429 (Div. 1) 题意: 给出一个数组, ...

  3. 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 解 只要不存在某个字母,它的 ...

  4. Codeforces Round #429 (Div. 2) 补题

    A. Generous Kefa 题意:n个气球分给k个人,问每个人能否拿到的气球都不一样 解法:显然当某种气球的个数大于K的话,就GG了. #include <bits/stdc++.h> ...

  5. Codeforces Round #429 (Div. 2)

    A. Generous Kefa   One day Kefa found n baloons. For convenience, we denote color of i-th baloon as  ...

  6. 【Codeforces Round #429 (Div. 2) C】Leha and Function

    [Link]:http://codeforces.com/contest/841/problem/C [Description] [Solution] 看到最大的和最小的对应,第二大的和第二小的对应. ...

  7. 【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))最 ...

  8. 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的度数为偶数 ...

  9. 【推导】【DFS】Codeforces Round #429 (Div. 1) B. Leha and another game about graph

    题意:给你一张图,给你每个点的权值,要么是-1,要么是1,要么是0.如果是-1就不用管,否则就要删除图中的某些边,使得该点的度数 mod 2等于该点的权值.让你输出一个留边的方案. 首先如果图内有-1 ...

随机推荐

  1. 90%程序员都没有完全答对Cookie和Session的区别

    我在做面试官的时候,曾经问过很多朋友这个问题: Cookie 和 Session 有什么区别呢?大部分的面试者应该都可以说上一两句,比如:什么是 Cookie?什么是 Session?两者的区别等. ...

  2. Counting Cliques(HDU-5952)【DFS】

    题目链接:https://vjudge.net/problem/HDU-5952 题意:有一张无向图,求结点数量为S的团的数量. 思路:如果不加一点处理直接用DFS必然会超时,因为在搜索过程中会出现遍 ...

  3. python学习-17 列表list 2

    # 1. 选择嵌套列表里的元素(内部进行了for循环) li = [1,2,",45]],"abc",True] a = li[3][2][1] print(a) 运行结 ...

  4. 02 servlet基础 生命周期 tomcat web.xml

    新建web项目 – new Web Project – 选择:javaee 5.0 建包 – com.gzsxt.wang 新建class:FirstServlet – 继承:HttpServlet( ...

  5. android 仿微信朋友圈图片选择控件

    调用方式(布局文件就是一个自定义控件): private ArrayList<String> selectedImages; @BindView(R.id.imagePicker) Ima ...

  6. .NET Core使用swagger遇到的坑

    今天突然点开写好的接口,突然发现展开时同时展开了两个接口.如图 我点这两个接口任意一个,这两个都会同时展开或折叠. 原因是他们actinName相同,虽然在vs里面只要http方法不同,action是 ...

  7. Deep Learning方向的paper

    转载 http://hi.baidu.com/chb_seaok/item/6307c0d0363170e73cc2cb65 个人阅读的Deep Learning方向的paper整理,分了几部分吧,但 ...

  8. requests Use body.encode('utf-8') if you want to send it encoded in UTF-8

    基本环境 使用 requests 模块发送 post 请求,请求体包含中文报错 系统环境:centos7.3 python版本:python3.6.8 请求代码: // 得到中文 param_json ...

  9. Java 面向对象(一)面向对象思想

    一.面向对象思想 1.概述 Java语言是一种面向对象的程序设计语言,而面向对象思想是一种程序设计思想,我们在面向对象思想的指引下,使用Java语言去设计.开发计算机程序. 这里的对象泛指现实中一切事 ...

  10. linux物理地址和虚拟地址定义

    线性地址(Linear Address) 是逻辑地址到物理地址变换之间的中间层 如果启用了分页机制,那么线性地址可以再经过变换以产生一个物理地址:如果没有启用分页机制,那么线性地址直接就是物理地址 分 ...