当前位置:网站首页>8VC Venture Cup 2017 - Elimination Round D. PolandBall and Polygon
8VC Venture Cup 2017 - Elimination Round D. PolandBall and Polygon
2022-06-28 05:08:00 【不吃土司边】
#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;
}
边栏推荐
- 吴恩达深度学习测验题:deeplearning.ai-week1-quiz
- Severe tire damage: the first rock band in the world to broadcast live on the Internet
- 2022年安全员-A证考试题库及模拟考试
- PHP code wechat, official account and enterprise wechat send emoticons [u+1f449]
- 2022新版nft源码中国元宇宙数字藏品艺术品交易平台源码
- 2022年低压电工考题及答案
- 如何从零设计一款牛逼的高并发架构(建议收藏)
- 汇编常用指令
- Assembly common instructions
- Qcom LCD commissioning
猜你喜欢

并发之wait/notify说明

Flexible IP network test tool -- x-launch

Learning Tai Chi Maker - mqtt Chapter II (VI) mqtt wills

Severe tire damage: the first rock band in the world to broadcast live on the Internet

!‘ Cat 'is not an internal or external command, nor is it a runnable program or batch file.

Carboxylic acid study: lumiprobe sulfoacyanine 7 dicarboxylic acid

BioVendor sRAGE蛋白解决方案

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

Lumiprobe cell imaging analysis: PKH26 cell membrane labeling kit

CPG 固体支持物研究:Lumiprobe通用 CPG II 型
随机推荐
Feign implements path escape through custom annotations
Light collector, Yunnan Baiyao!
Flexible IP network test tool -- x-launch
Extjs library management system source code intelligent library management system source code
Voltage mode and current mode control of switching power supply
Sorting out some topics of modern exchange principle MOOC
无线传感器网络学习笔记(一)
BioVendor sRAGE抗体解决方案
109. simple chat room 12: realize client-side one-to-one chat
IP数据报的发送和转发过程
2022高处安装、维护、拆除考试题及答案
The latest examination questions and answers for the eight members (standard members) of Liaoning architecture in 2022
?位置怎么写才能输出true
基于微信小程序的婚纱影楼门户小程序
109. 简易聊天室12:实现客户端一对一聊天
Dart learning - functions, classes
公司为什么选择云数据库?它的魅力到底是什么!
Simulation questions and answers of the latest national fire-fighting facility operators (primary fire-fighting facility operators) in 2022
Keil C51的Data Overlaying机制导致的函数重入问题
Simple usage of GSAP