2018 ACM 国际大学生程序设计竞赛上海大都会赛重现赛 H - A Simple Problem with Integers (线段树,循环节)

链接:https://ac.nowcoder.com/acm/contest/163/H

来源:牛客网

链接:https://ac.nowcoder.com/acm/contest/163/H来源:牛客网

时间限制:C/C++ 2秒,其他语言4秒

空间限制:C/C++ 262144K,其他语言524288K

64bit IO Format: %lld

题目描述

You have N integers A1, A2, ... , AN. You are asked to write a program to receive and execute two kinds of instructions:

\1. C a b means performing Ai = (Ai2 mod 2018) for all Ai such that a ≤ i ≤ b.

\2. Q a b means query the sum of Aa, Aa+1, ..., Ab. Note that the sum is not taken modulo 2018.

输入描述:

The first line of the input is T(1≤ T ≤ 20), which stands for the number of test cases you need to solve.The first line of each test case contains N (1 ≤ N ≤ 50000).The second line contains N numbers, the initial values of A1, A2, ..., An.  0 ≤ Ai < 2018. The third line contains the number of operations Q (0 ≤ Q ≤ 50000). The following Q lines represents an operation having the format "C a b" or "Q a b", which has been described above. 1 ≤ a ≤ b ≤ N.

输出描述:

For each test case, print a line "Case #t:" (without quotes, t means the index of the test case) at the beginning.You need to answer all Q commands in order. One answer in a line.

示例1

输入

[复制](javascript:void(0)

2018 ACMICPC上海大都会赛重现赛 H - A Simple Problem with Integers (线段树,循环节)的更多相关文章

  1. The 2018 ACM-ICPC上海大都会赛 J Beautiful Numbers (数位DP)

    题意:求小于等于N且能被自己所有位上数之和整除的数的个数. 分析:裸的数位dp.用一个三位数组dp[i][j][k]记录:第i位,之前数位之和为j,对某个mod余数为k的状态下满足条件的个数.这里mo ...

  2. 2018 ACM 国际大学生程序设计竞赛上海大都会赛重现赛 F Color it

    链接:https://www.nowcoder.com/acm/contest/163/F 来源:牛客网 2018 ACM 国际大学生程序设计竞赛上海大都会赛重现赛 F Color it 时间限制:C ...

  3. 2018 ACM 国际大学生程序设计竞赛上海大都会赛重现赛 F Color it (扫描线)

    2018 ACM 国际大学生程序设计竞赛上海大都会赛重现赛 F Color it (扫描线) 链接:https://ac.nowcoder.com/acm/contest/163/F来源:牛客网 时间 ...

  4. 2018 ACM 国际大学生程序设计竞赛上海大都会赛重现赛 J Beautiful Numbers (数位DP)

    2018 ACM 国际大学生程序设计竞赛上海大都会赛重现赛 J Beautiful Numbers (数位DP) 链接:https://ac.nowcoder.com/acm/contest/163/ ...

  5. 2018 ICPC上海大都会赛重现赛 D Thinking-Bear magic (几何)

    2018 ACM 国际大学生程序设计竞赛上海大都会赛重现赛 D Thinking-Bear magic (几何) 链接:https://ac.nowcoder.com/acm/contest/163/ ...

  6. 牛客 Fruit Ninja 2018 ACM 上海大都会赛 (随机化算法)

    题目链接:Fruit Ninja 比赛链接:2018 ACM 国际大学生程序设计竞赛上海大都会赛重现赛 题目描述 Fruit Ninja is a juicy action game enjoyed ...

  7. 计蒜客 39272.Tree-树链剖分(点权)+带修改区间异或和 (The 2019 ACM-ICPC China Shannxi Provincial Programming Contest E.) 2019ICPC西安邀请赛现场赛重现赛

    Tree Ming and Hong are playing a simple game called nim game. They have nn piles of stones numbered  ...

  8. ACM-ICPC 2018 沈阳赛区现场赛 E. The Kouga Ninja Scrolls (切比雪夫距离+线段树)

    题目链接: 题意:在二维平面上有 n 个人,每个人有一个位置(xi, yi)和门派 ci,m 个操作:①改变第 k 个人的位置:②改变第 k 个人的门派:③询问区间[l,r]之间不同门派的两个人的最大 ...

  9. 2018牛客网暑假ACM多校训练赛(第六场)I Team Rocket 线段树

    原文链接https://www.cnblogs.com/zhouzhendong/p/NowCoder-2018-Summer-Round6-I.html 题目传送门 - https://www.no ...

随机推荐

  1. JSON Hijacking漏洞

    https://github.com/SkyLined/LocalNetworkScanner JS.利用浏览器漏洞当对方打开网址时,扫描对方内网信息 https://www.freebuf.com/ ...

  2. Java进阶教程:使用Lombok提升开发效率

    Java进阶教程:使用Lombok提升开发效率 Lombok Lombok是一种Java™实用工具,可用来帮助开发人员消除Java的冗长代码,尤其是对于简单的Java对象(POJO).它通过注释实现这 ...

  3. [转载]SQL Server提权系列

    本文原文地址:https://www.cnblogs.com/wintrysec/p/10875232.html 一.利用xp_cmdshell提权 xp_cmdshell默认是关闭的,可以通过下面的 ...

  4. 安装AWX

    1.安装最新版python 2.安装最新版docker 设置国内docker镜像源 curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | ...

  5. Spring Boot制作启动图案

    SpringBoot在启动时会有一个默认图案的,如果不喜欢可以自己制作一个. 在resources的目录下新建banner.txt文件. 制作图案地址:springboot启动图案定制 通过输入字符串 ...

  6. [DevExpress] - 使得 XtraEditors.TextEdit 失去焦点(LostFocus)的方法

    场景 WinForm 应用,使用了 DevExpress.XtraEditors.TextEdit 控件的 KeyPress 和 Leave 事件.期望在 TextEdit 上按下回车键或者当 Tex ...

  7. Tomcat中不能通过访问自己IP,但可以通过localhost/127.0.0.1访问

    一.问题如下:局域网内,自己机器部署了一个tomcat应用,在本机上可以通过如下方式访问引用.  http://localhost:8080/xxxx http://127.0.0.1:8080/xx ...

  8. 面试题之web访问突然延迟问题

    前言 面试官经常会问平时访问正常的网页突然变慢是什么原因引起的,说明下你排查的思路:我认为这种问题很能考察一个人的综合知识面,既能融通的贯彻知识点,也能展看对每个知识点进行详细的考问. 下面我按我自己 ...

  9. python检测当前网卡流量信息,用于查看实时网速

    可以用来检测是否有挖矿程序在运行的一个子条件 # coding:utf-8 __author__ = 'chenhuachao' import wmi import time import platf ...

  10. elk 流程图

    ELK流程图 单纯使用ElK实现分布式日志收集缺点: 1.logstash太多了,扩展不好. 2.读取IO文件,可能会产生日志丢失 3.不是实时性 这时候就需要引入 kafka. kafka基于主题模 ...