Codeforces Round #254 (Div. 2)D(预计)
1 second
256 megabytes
standard input
standard output
DZY loves Fast Fourier Transformation, and he enjoys using it.
Fast Fourier Transformation is an algorithm used to calculate convolution. Specifically, if a, b and c are
sequences with length n, which are indexed from 0 to n - 1,
and
We can calculate c fast using Fast Fourier Transformation.
DZY made a little change on this formula. Now
To make things easier, a is a permutation of integers from 1 to n,
and b is a sequence only containing 0 and 1.
Given a and b, DZY needs your help to calculate c.
Because he is naughty, DZY provides a special way to get a and b.
What you need is only three integers n, d, x.
After getting them, use the code below to generate a and b.
//x is 64-bit variable;
function getNextX() {
x = (x * 37 + 10007) % 1000000007;
return x;
}
function initAB() {
for(i = 0; i < n; i = i + 1){
a[i] = i + 1;
}
for(i = 0; i < n; i = i + 1){
swap(a[i], a[getNextX() % (i + 1)]);
}
for(i = 0; i < n; i = i + 1){
if (i < d)
b[i] = 1;
else
b[i] = 0;
}
for(i = 0; i < n; i = i + 1){
swap(b[i], b[getNextX() % (i + 1)]);
}
}
Operation x % y denotes remainder after division x by y.
Function swap(x, y) swaps two values x and y.
The only line of input contains three space-separated integers n, d, x (1 ≤ d ≤ n ≤ 100000; 0 ≤ x ≤ 1000000006).
Because DZY is naughty, x can't be equal to 27777500.
Output n lines, the i-th line should contain an integer ci - 1.
3 1 1
1
3
2
5 4 2
2
2
4
5
5
5 4 3
5
5
5
5
4
Codeforces Round #254 (Div. 2)D(预计)的更多相关文章
- Codeforces Round 254 (Div. 2)
layout: post title: Codeforces Round 254 (Div. 2) author: "luowentaoaa" catalog: true tags ...
- Codeforces Round #254 (Div. 1) C. DZY Loves Colors 线段树
题目链接: http://codeforces.com/problemset/problem/444/C J. DZY Loves Colors time limit per test:2 secon ...
- Codeforces Round #254 (Div. 1) D - DZY Loves Strings
D - DZY Loves Strings 思路:感觉这种把询问按大小分成两类解决的问题都很不好想.. https://codeforces.com/blog/entry/12959 题解说得很清楚啦 ...
- Codeforces Round #254 (Div. 1) D. DZY Loves Strings hash 暴力
D. DZY Loves Strings 题目连接: http://codeforces.com/contest/444/problem/D Description DZY loves strings ...
- Codeforces Round #254 (Div. 1) C. DZY Loves Colors 分块
C. DZY Loves Colors 题目连接: http://codeforces.com/contest/444/problem/C Description DZY loves colors, ...
- Codeforces Round #254 (Div. 1) A. DZY Loves Physics 智力题
A. DZY Loves Physics 题目连接: http://codeforces.com/contest/444/problem/A Description DZY loves Physics ...
- Codeforces Round #254 (Div. 2) A. DZY Loves Chessboard —— dfs
题目链接: http://codeforces.com/problemset/problem/445/A 题解: 这道题是在现场赛的最后一分钟通过的,相当惊险,而且做的过程也很曲折. 先是用递推,结果 ...
- Codeforces Round #254 (Div. 1) C DZY Loves Colors
http://codeforces.com/contest/444/problem/C 题意:给出一个数组,初始时每个值从1--n分别是1--n. 然后两种操作. 1:操作 a.b内的数字是a,b内 ...
- [题解]Codeforces Round #254 (Div. 2) B - DZY Loves Chemistry
链接:http://codeforces.com/contest/445/problem/B 描述:n种药品,m个反应关系,按照一定顺序放进试管中.如果当前放入的药品与试管中的药品要反应,危险系数变为 ...
随机推荐
- Windows Azure 社区新闻综述(#75 版)
欢迎查看最新版本的每周综述,其中包含有关云计算和 Windows Azure 的社区推动新闻.内容和对话.以下是本周的亮点. 文章.视频和博客文章 · PowerShell 对 Windows A ...
- ios7状态栏属性的设置
/* 状态栏的管理: 1> iOS7之前:UIApplication进行管理 2> iOS7开始:交给对应的控制器去管理 */ // 设置状态栏的样式 - (UIStatusBarStyl ...
- BZOJ 1385: [Baltic2000]Division expression
题目 1385: [Baltic2000]Division expression Time Limit: 5 Sec Memory Limit: 64 MB Description 除法表达式有如下 ...
- javascript学习(10)——[知识储备]链式调用
上次我们简单的说了下单例的用法,这个也是在我们java中比较常见的设计模式. 今天简单说下链式调用,可能有很多人并没有听过链式调用,但是其实只要我简单的说下的话,你肯定基本上都在用,大家熟知的jQue ...
- 2015 款 Macbook Pro 的 ForceTouch 触控板开启 三指拖动
RT, 默认的触控板设置中没有了三指拖动这个选项, 但是可以通过勾选 辅助功能 -> 鼠标与触控板 -> 触控板选项 中的 启用拖移 来启用三指拖动...
- GIT在windows下搭建
/*********工具准备********* *copSSH *msysgit *TortiseGIT *putty * 安装比较简单,此处省略... *********************** ...
- Windows(64位IIS)未在本地计算机上注册“Microsoft.Jet.OLEDB.4.0”提供程序
在Windows 7(32位)用.Net开发的Excel导入数据表功能,测试后一切正常,站点发布挪到Windows Server 2008(64位)上就意外了,出现错误提示,运行程序,抛出异常:未在本 ...
- python子进程模块subprocess调用shell命令
http://www.cnblogs.com/vamei/archive/2012/09/23/2698014.html
- Codeforces 482 - Diverse Permutation 构造题
这是一道蛮基础的构造题. - k +(k - 1) -(k - 2) 1 + k , 1 , k , 2, ....... ...
- 用QFileSystemWatcher来监视文件和目录的改变(内部还是使用了timer)
Use Case: 两个程序共享同一个Configuration文件,当一个程序作出改变的时候,需要另外一个程序能够及时响应. 之前其实猜的八九不离十,估计是有一个Timer,然后定时查询Config ...