链接

[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. Django框架的使用教程--视图和路由[二]

    视图和路由 1.创建一个django_test应用 2.setting中设置django_test INSTALLED_APPS = [ 'django.contrib.admin', 'django ...

  2. gitlab的使用(待书写)

    1. [root@docker ~]# yum -y install git

  3. Sublime Text的使用

    本文目录 1.下载安装Sublime Text 2.配置Python IDE环境 3.sublime anaconda载入出现错误 4.Sublime Text快捷键 1.下载安装Sublime Te ...

  4. SpringMVC 常用applicationContext.xml、web.xml、servlet-mvc.xml简单配置

    在进行学习配置文件之前,为了加深对框架的认识,简单的做了SSM框架的简单实验.然后画出listAll查询方法的整个过程的思维导图. 整个过程中的web.xml.SpringMVC.xml.applic ...

  5. CSS3渐变——线性渐变

    渐变背景一直以来在Web页面中都是一种常见的视觉元素.但一直以来,Web设计师都是通过图形软件设计这些渐变效果,然后以图片形式或者背景图片的形式运用到页面中.Web页面上实现的效果,仅从页面的视觉效果 ...

  6. nginx服务器常见错误代码500、501、502、503、504、505

    一:500错误 1.500 Internal Server Error 内部服务错误:顾名思义500错误一般是服务器遇到意外情况,而无法完成请求. 2.500出错的可能性: a.编程语言语法错误,we ...

  7. oracle创建em

    语法:emca -config dbcontrol db [-repos (create | recreate)] [-cluster] [-silent] [-backup] [parameters ...

  8. Intellij Idea免费激活方法(转)

    文章转自  http://blog.csdn.net/u013772876/article/details/70763759 1.填入下面的license server: http://intelli ...

  9. kubernetes环境搭建

    两台服务器 centos-master  172.16.120.189 centos-minion  172.16.120.190 master上运行etcd, kube-apiserver, kub ...

  10. ASP.NET 加密解密

    1.MD5 2.DES 一 MD5 介绍:MD5是不可逆解密方式,比如对密码的加密,为了保密,让密码不能解密 public static string MD5Encrypt(string str) { ...