codeforces -1214 E
题目https://codeforces.com/problemset/problem/1214/E
就是得知奇数之间不产生影响,先造出一条链,再用偶数往里插就行。链要di从大到小排个序呀!!
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#define maxn 202000
using namespace std;
struct Node {
int ans;
int pos;
}list[maxn];
bool bml(Node a, Node b) {
return a.ans > b.ans;
}
vector<int>ans;
int main() {
int n; scanf("%d", &n);
for (int i = 1; i <= n; i++) {
scanf("%d", &list[i].ans);
list[i].pos = i * 2 - 1;//奇数
}
sort(list + 1, list + 1 + n, bml);
for (int i = 1; i < n; i++) {
printf("%d %d\n", list[i].pos, list[i + 1].pos);
ans.push_back(list[i].pos);
}
ans.push_back(list[n].pos); for (int i = 1; i <= n; i++) {
int t = list[i].ans + i - 2; printf("%d %d\n", ans[t], list[i].pos + 1);
if (ans.size()-1 == t) ans.push_back(list[i].pos + 1);
}
return 0;
}
codeforces -1214 E的更多相关文章
- Codeforces 1214 F G H 补题记录
翻开以前打的 #583,水平不够场上只过了五题.最近来补一下题,来记录我sb的调试过程. 估计我这个水平现场也过不了,因为前面的题已经zz调了好久-- F:就是给你环上一些点,两两配对求距离最小值. ...
- codeforces 1214
D 比赛的时候居然看漏了条件... 若在(x, y)格子,那么只能移动到(x+1, y)或(x, y+1) 这样的话就好做了,直接dp,然后统计每一种路径长度经过的点数. #include<cs ...
- python爬虫学习(5) —— 扒一下codeforces题面
上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题 ...
- 【Codeforces 738D】Sea Battle(贪心)
http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n g ...
- 【Codeforces 738C】Road to Cinema
http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants ...
- 【Codeforces 738A】Interview with Oleg
http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interv ...
- CodeForces - 662A Gambling Nim
http://codeforces.com/problemset/problem/662/A 题目大意: 给定n(n <= 500000)张卡片,每张卡片的两个面都写有数字,每个面都有0.5的概 ...
- CodeForces - 274B Zero Tree
http://codeforces.com/problemset/problem/274/B 题目大意: 给定你一颗树,每个点上有权值. 现在你每次取出这颗树的一颗子树(即点集和边集均是原图的子集的连 ...
- CodeForces - 261B Maxim and Restaurant
http://codeforces.com/problemset/problem/261/B 题目大意:给定n个数a1-an(n<=50,ai<=50),随机打乱后,记Si=a1+a2+a ...
随机推荐
- 网络编程--多线程 , socketserver
内容补充 python2与python3的区别? """ python3对unicode字符的原生支持 Python2中使用ASCII码作为默认编码方式导致string有 ...
- 2019-8-31-dotnet-使用-lz4net-压缩-Stream-或文件
title author date CreateTime categories dotnet 使用 lz4net 压缩 Stream 或文件 lindexi 2019-08-31 16:55:58 + ...
- @CSP模拟2019.10.16 - T3@ 垃圾分类
目录 @description@ @solution@ @accepted code@ @details@ @description@ 为了保护环境,p6pou建设了一个垃圾分类器. 垃圾分类器是一个 ...
- install tushare in python 3.6
install tushare (D:\Anaconda3) C:\Users\Administrator>pip install tushare Collecting tushare Down ...
- Codeforces Round #591 (Div. 2, based on Technocup 2020 Elimination Round 1) 题解
A..B略 C 对当前的值排序,再二分答案,然后对于(i%x==0 && i%y==0)放入大的,再放其他的贪心解决即可. #include<iostream> #incl ...
- oracle函数 trunc(x[,y])
[功能]返回x按精度y截取后的值 [参数]x,y,数字型表达式,如果y不为整数则截取y整数部分,如果y>0则截取到y位小数,如果y小于0则截取到小数点向左第y位,小数前其它数据用0表示. [返回 ...
- oracle函数 LOWER(c1)
[功能]:将字符串全部转为小写 [参数]:c1,字符表达式 [返回]:字符型 [示例] SQL> select lower('AaBbCcDd')AaBbCcDd from dual; AABB ...
- 利用阿里云容器服务打通TensorFlow持续训练链路
本系列将利用Docker和阿里云容器服务,帮助您上手TensorFlow的机器学习方案 第一篇:打造TensorFlow的实验环境 第二篇:轻松搭建TensorFlow Serving集群 第三篇:打 ...
- CREATE OR REPLACE FUNCTION
CREATE OR REPLACE FUNCTION SF_Taishou_Ksai_Date(v_receiptNum IN CHAR, ...
- sublime简介
Sublime Text是一个代码编辑器.也是HTML和散文先进的文本编辑器.漂亮的用户界面和非凡的功能,例如:多选择,Python插件,代码段等等.完全可自定义键绑定,菜单和工具栏等等.漂亮的用户界 ...