树状数组,$map$. 可以理解为开一个数组$f[i][j]$记录:$i$这个数字在时间$j$的操作情况. 操作$1$:$f[x][t]++$.操作$2$:$f[x][t]--$.操作$3$:$f[x][1]$至$f[x][t]$求和. 数组开不出来,但可以开$map$,状态最多$100000$个,所以还是不会超时的,数字范围有点大,可以离散化一下. #pragma comment(linker, "/STACK:1024000000,1024000000") #include<…
题目链接: E. Little Artem and Time Machine time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Little Artem has invented a time machine! He could go anywhere in time, but all his thoughts of cours…
E. Little Artem and Time Machine 题目连接: http://www.codeforces.com/contest/669/problem/E Description Little Artem has invented a time machine! He could go anywhere in time, but all his thoughts of course are with computer science. He wants to apply thi…
题目链接: Codeforces 669D Little Artem and Dance 题目描述: 给一个从1到n的连续序列,有两种操作: 1:序列整体向后移动x个位置, 2:序列中相邻的奇偶位置互换. 问:q次操作后,输出改变后的序列? 解题思路: 刚开始只看了第一组样例,发现相邻的奇偶位一直在一起,于是乎就开始writing code,写完后发现并不是正解!!!!就去推了一下第三个样例,总是这组实例通过,那组实例卡死,,,,,,,最后终于成功的Mengbility.今天突然想起来,其实整体…
题目传送门 题意:现在有3种操作, 1 t x 在t秒往multiset里面插入一个x 2 t x 在t秒从multiset里面删除一个x 3 t x 在t秒查询multiset里面有多少x 事情是按照输入顺序发生的,这个人有一个时光机,可以穿梭到那一秒去执行操作. 题解:CDQ分治.3维偏序,第一维是输入顺序,第二维t,然后直接map处理数据就好了. 代码: #include<bits/stdc++.h> using namespace std; #define Fopen freopen(…
Little Artem has invented a time machine! He could go anywhere in time, but all his thoughts of course are with computer science. He wants to apply this time machine to a well-known data structure: multiset. Artem wants to create a basic multiset of…
题目链接: C. Artem and Array time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Artem has an array of n positive integers. Artem decided to play with it. The game consists of n moves. Each move g…
http://codeforces.com/problemset/problem/669/D 题意:n个数1~N围成一个圈.q个操作包括操作1:输入x, 所有数右移x.操作2:1,2位置上的数(swap(a[1], a[2])交换:3,4交换.... 题解:观察,发现所有奇数行为都是一样的,偶数同理,(对于操作1 两者相同,对于操作2 奇数位++,偶数位上--: 模拟1,2,即可,然后依次输出其它数字即可.(看清 ac代码: #define _CRT_SECURE_NO_WARNINGS #in…
B. Little Artem and Dance time limit per test 2 second memory limit per test 256 megabytes input standard input output standard output Little Artem is fond of dancing. Most of all dances Artem likes rueda - Cuban dance that is danced by pairs of boys…
题目链接:http://codeforces.com/contest/668/problem/C ------------------------------------------------------------------------------------------- 大概看一下发现题目给了一些条件限制 然后要解一个方程组 不过数据范围很大 如果直接去解的话显然很困难 考虑到此题是建立在概率的模型上的 因此我们可以用前缀和的方式先把输入处理一下 然后就转化为以下子问题 $0 <= x…