/*
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. 制作一个centos+jdk8+tomcatd9镜像

    docker解析:     1.登录docker             docker ecex –it 容器名/容器id /bin/bash         例如:             dock ...

  2. python中列表之间求差集、交集、并集

    求两个列表的交集.并集.差集 def diff(listA, listB): # 求交集的两种方式 retA = [i for i in listA if i in listB] retB = lis ...

  3. 轻松搭建CAS 5.x系列(7)-在CAS Server使用第三方帐号做认证

    概述说明 CAS除了使用自身数据库配置的帐号体系外,也可以使用第三方帐号来做认证. 比如实现如下类似的红色标注部分的登录效果: CAS自带了Facebook.GitHub.WordPress和CAS的 ...

  4. 电子口岸 打开“退税联打印”时,PDF界面无法显示

    电子口岸 打开“退税联打印”时,PDF界面无法显示 咨询0571-95198 : IE要在8-10间,系统 要Win7 32B ---------------------参考------------- ...

  5. .htaccess 转 SAE AppConfig

    新浪的SAE不支持 htaccess,但是他们开发了 AppConfig,可以完全代替 htaccess 的常见功能,AppConfig采用类自然语言的规则描述,还是很人性化的. 这里来写一个短网址的 ...

  6. 函数实现计算等差数列的第n项

    等差数列的第n项 描述 等差数列是指从第二项起,每一项与它的前一项的差等于同一个常数的一种数列,这个常数叫做等差数列的公差.‪‬‪‬‪‬‪‬‪‬‮‬‪‬‭‬‪‬‪‬‪‬‪‬‪‬‮‬‪‬‫‬‪‬‪‬‪‬ ...

  7. Django对postgresql数据库进行分组聚合查询

    action(methods=['GET'], detail=False, url_path='count') def count(self, request): """ ...

  8. 改写Unity DropDown 支持多次点击同一选项均回调

    [很久前的一个Note,不知道现在的Unity Dropdown是否已经支持该特性] Unity UGUI是开源的: https://bitbucket.org/Unity-Technologies/ ...

  9. java如何在不访问数据库就可以对list分页?

    废话不多说,直接上代码 import java.util.ArrayList; import java.util.List; public class demo { public static voi ...

  10. /sockjs-node/info 报错问题

    首先 sockjs-node 确实是维持全双工通信用的,关键在于为什么要有这个东西,其实其作用就是保证我们在改完代码重新编译之后,能够通知浏览器重新加载变更结果(我也是因为之前都可以改完代码之后浏览器 ...