链接

[https://codeforces.com/contest/1088/problem/C]

题意

n个数,最多n+1操作,要么前i个数加x,要么前i个数对x取余,最后使得严格递增

分析

直接进行n+1次,开始所有数都加上5e5+10;

后面n次,从1开始到n对a[i]-i+1取余,就能保证严格递增

代码

#include<bits/stdc++.h>
using namespace std;
const int N=2e3+10;
const int ma=5e5+10;
int a[N];
int main(){
ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
//freopen("in.txt","r",stdin);
int n;
while(cin>>n){
for(int i=1;i<=n;i++) {
cin>>a[i]; a[i]+=ma;
}
cout<<n+1<<endl;
cout<<1<<' '<<n<<' '<<ma<<endl;
for(int i=1;i<=n;i++)
cout<<2<<' '<<i<<' '<<a[i]-i+1<<endl;
}
return 0;
}

C. Ehab and a 2-operation task的更多相关文章

  1. Codeforces 959F Mahmoud and Ehab and yet another xor task 线性基 (看题解)

    Mahmoud and Ehab and yet another xor task 存在的元素的方案数都是一样的, 啊, 我好菜啊. 离线之后用线性基取check存不存在,然后计算答案. #inclu ...

  2. Codeforces 959 F. Mahmoud and Ehab and yet another xor task

    \(>Codeforces\space959 F. Mahmoud\ and\ Ehab\ and\ yet\ another\ xor\ task<\) 题目大意 : 给出一个长度为 \ ...

  3. codeforces-473D Mahmoud and Ehab and another array construction task (素数筛法+贪心)

    题目传送门 题目大意:先提供一个数组,让你造一个数组,这个数组的要求是 1 各元素之间都互质  2  字典序大于等于原数组  3 每一个元素都大于2 思路: 1.两个数互质的意思就是没有公因子.所以每 ...

  4. Codeforces 959D. Mahmoud and Ehab and another array construction task(构造, 简单数论)

    Codeforces 959D. Mahmoud and Ehab and another array construction task 题意 构造一个任意两个数都互质的序列,使其字典序大等于a序列 ...

  5. 959F - Mahmoud and Ehab and yet another xor task xor+dp(递推形)+离线

    959F - Mahmoud and Ehab and yet another xor task xor+dp+离线 题意 给出 n个值和q个询问,询问l,x,表示前l个数字子序列的异或和为x的子序列 ...

  6. D. Mahmoud and Ehab and another array construction task 因子分界模板+贪心+数学

    D. Mahmoud and Ehab and another array construction task 因子分解模板 题意 给出一个原序列a 找出一个字典序大于a的序列b,使得任意 \(i!= ...

  7. CF959D Mahmoud and Ehab and another array construction task 数学

    Mahmoud has an array a consisting of n integers. He asked Ehab to find another array b of the same l ...

  8. Codeforces 959 D Mahmoud and Ehab and another array construction task

    Discription Mahmoud has an array a consisting of n integers. He asked Ehab to find another arrayb of ...

  9. [CF959F]Mahmoud and Ehab and yet another xor task题解

    搞n个线性基,然后每次在上一次的基础上插入读入的数,前缀和线性基,或者说珂持久化线性基. 然后一个num数组记录当时线性基里有多少数 然后每次前缀操作一下就珂以了 代码 #include <cs ...

  10. [CF959D]Mahmoud and Ehab and another array construction task题解

    解法 非常暴力的模拟. 一开始吧\(1 -> 2 \times 10^6\)全部扔进一个set里,如果之前取得数都是与原数组相同的,那么lower_bound一下找到set中大于等于它的数,否则 ...

随机推荐

  1. Linux 修改用户组后,如何关闭所有 X session 下使得组生效?

    最近在使用 docker-ce ,在配置当前用户组为 docker 的时候(sudo usermod -aG docker $USER)发现:必须要关闭当前的 session 重新登录 后,才能使得修 ...

  2. Centos7.5调试/etc/sysctl.conf文件导致宕机

    今天安装greenplus数据库,需要调试一个核心文件/etc/sysctl.conf文件,结果导致系统异常宕机,出现的问题就是使用任何命令都不能输出正确的结果,只有这个显示: 不知道是什么原因,ls ...

  3. VMWare:vSphere6 企业版参考序列号

    HV4WC-01087-1ZJ48-031XP-9A843 NF0F3-402E3-MZR80-083QP-3CKM2 4F6FX-2W197-8ZKZ9-Y31ZM-1C3LZ JZ2E9-6D2D ...

  4. SSRS奇怪报错Could not update a list of fields for the quer.

    今天遇到一个奇怪的问题,SSRS我觉得是个半成品,很多东西都搞不了.写了一段SQL,本来SQL写法都有点怪了,如下 WITH TMP_A AS (SELECT *,ROW_NUMBER() OVER( ...

  5. Java:传值还是传引用?

    这是一个Java的经典问题,大部分人从C,C++语言入门,C语言有三种传递方式:值传递,地址传递和引用传递.详细的对C语言指针,引用的我个人的理解,见链接. Java所有操作都是传值操作!都是传值操作 ...

  6. 关于Hamilton问题的研究

    关于Hamilton问题的研究 首先介绍一下Hamilton问题:哈密顿问题寻找一条从给定的起点到给定的终点沿途恰好经过所有其他结点一次的路径.(摘自百度百科) 从刚开始学OI买了信息学一本通,这个问 ...

  7. linux(centos 7)下安装elasticsearch - head插件(端口占用,防火墙关闭)

    本文章来自网络仅供个人学习记录之用 一:安装Git(如果未安装) 1, yum install git 2, git --version #查看版本 二:安装node(如果未安装) node安装 三: ...

  8. yii2场景

    遇到的问题 起作用了但是使用create的时候,保存却出了问题,提示unknown scenarios:default 解决方法 后来找文章,是因为设置场景的时候,直接把父类的场景覆盖了.所以应该这样 ...

  9. OnlineJudgeFE之前端二次开发

    之前我们在这篇文章青岛大学开源OJ平台搭建 讲了关于它的安装和部署. 今天我们讨论如何对其进行二次开发.首先谈谈前端的二次开发. 如果想要对青岛大学的OJ项目进行二次开发,目前我觉得要满足这么几个要求 ...

  10. springcloud单个服务内存使用详情

    查看单个进程的服务占用率 [root@insure dev]# ps -aux|grep claimoauth root ? Sl Dec27 : java -jar /opt/dev/claimoa ...