当前位置:网站首页>8VC Venture Cup 2017 - Elimination Round D. PolandBall and Polygon
8VC Venture Cup 2017 - Elimination Round D. PolandBall and Polygon
2022-06-28 05:19:00 【No toast】
#include<bits/stdc++.h>
using namespace std;
#define X first
#define Y second
#define eps 1e-2
#define gcd __gcd
#define pb push_back
#define PI acos(-1.0)
#define lowbit(x) (x)&(-x)
#define bug printf("!!!!!\n");
#define mem(x,y) memset(x,y,sizeof(x))
typedef long long LL;
typedef long double LD;
typedef pair<int,int> pii;
typedef unsigned long long uLL;
#define int long long
const int N = 1e6+2;
const int INF = 1<<30;
const int mod = 1e9+7;
int n,k;
struct BIT{
int n,c[N];
void init(int _n){
n=_n;for(int i=1;i<=n;++i) c[i]=0;}
int Lowbit(int x){
return x&(-x); }
int get_sum(int k){
int ans=c[k];while((k-=Lowbit(k))>0) ans+=c[k];return ans;}
void add(int t,int v){
c[t]+=v;while((t+=Lowbit(t))<=n) c[t]+=v;}
}bit1;
int get(int l,int r){
return bit1.get_sum(r)-bit1.get_sum(l-1);
}
void solve(){
scanf("%lld%lld",&n,&k);
bit1.init(N-1);
int st=1,ed=1+k,ans=1;
if(k>n/2) k=n-k;
for(int i=1;i<=n;i++){
ed=(st+k-1)%n+1;
// cout<<st<<" "<<ed<<endl;
if(st>ed){
ans+=1+get(1,ed-1)+get(st+1,n);
}else{
ans+=1+get(st+1,ed-1);
}
bit1.add(st,1);
bit1.add(ed,1);
st=ed;
cout<<ans<<" ";
}cout<<endl;
return;
}
int32_t main()
{
// freopen("in.txt","r",stdin);
// freopen("out.txt","w",stdout);
// ios::sync_with_stdio(false);
int t = 1;
//scanf("%d",&t);
while(t--){
// printf("Case %d: ",cas++);
solve();
}
return 0;
}
边栏推荐
- 程序员-放羊娃
- Informatics Orsay all in one 1360: strange lift
- How to learn programmable logic controller (PLC)?
- wordpress zibll子比主题6.4.1开心版 免授权
- [microservices openfeign] openfeign quick start service invocation based on feign
- lotus v1.16.0 calibnet
- openssl客户端编程:一个不起眼的函数导致的SSL会话失败问题
- Question bank and answers of 2022 materialman general basic (materialman) operation certificate examination
- 禁用右击、键盘打开控制台事件
- If a programmer goes to prison, will he be assigned to write code?
猜你喜欢

DH parameters of robotics and derivation using MATLAB symbolic operation

【LeetCode】12、整数转罗马数字

分享|智慧环保-生态文明信息化解决方案(附PDF)

mysql导出数据库字典成excel文件

!‘cat‘ 不是内部或外部命令,也不是可运行的程序 或批处理文件。

如何从零设计一款牛逼的高并发架构(建议收藏)

CPG 固体支持物研究:Lumiprobe通用 CPG II 型

Lumiprobe细胞成像分析:PKH26 细胞膜标记试剂盒

How does the power outlet transmit electricity? Simple problems that have plagued my little friend for so many years

Feign通过自定义注解实现路径的转义
随机推荐
Sorting out some topics of modern exchange principle MOOC
Qcom LCD commissioning
CPG 固体支持物研究:Lumiprobe通用 CPG II 型
109. simple chat room 12: realize client-side one-to-one chat
SlicePlane的Heading角度与Math.atan2(y,x)的对应转换关系
吴恩达深度学习测验题:deeplearning.ai-week1-quiz
Intensive learning notes
!‘cat‘ 不是内部或外部命令,也不是可运行的程序 或批处理文件。
Lumiprobe细胞成像分析:PKH26 细胞膜标记试剂盒
OpenSSL client programming: SSL session failure caused by an obscure function
2022 high altitude installation, maintenance and removal examination questions and answers
IP datagram sending and forwarding process
开关电源电压型与电流型控制
quartus 复制IP核
When using the MessageBox of class toplevel, a problem pops up in the window.
基于订单流工具,我们能看到什么?
Study on modified triphosphate: lumiprobe amino-11-ddutp
Unity out ref params
If a programmer goes to prison, will he be assigned to write code?
2022电力电缆判断题模拟考试平台操作