当前位置:网站首页>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;
}
边栏推荐
- 分享一个因子挖掘的利器:遗传规划
- Meta universe standard forum established
- Light collector, Yunnan Baiyao!
- Is it enough for the project manager to finish the PMP? no, it isn't!
- 穿越封锁的最新利器,速度最快梯没有之一。
- 程序员-放羊娃
- gsap的简单用法
- QCOM LCD调试
- Extjs library management system source code intelligent library management system source code
- 交流电和直流电的区别是什么?
猜你喜欢

Mask's miserable and inspirational childhood, who is introverted by campus violence

JS text box loses focus to modify width text and symbols

Keil C51的Data Overlaying机制导致的函数重入问题

Store inventory management system source code

Operation of simulated examination platform of G3 boiler water treatment recurrent training question bank in 2022

IP datagram sending and forwarding process
![[noip2002 popularization group] cross the river pawn](/img/6c/31fa210e08c7fd07691a1c5320154e.png)
[noip2002 popularization group] cross the river pawn

Feign implements path escape through custom annotations

活性染料研究:Lumiprobe AF594 NHS 酯,5-异构体

Simulation questions and answers of the latest national fire-fighting facility operators (primary fire-fighting facility operators) in 2022
随机推荐
Understanding the source of innovation II
Meta universe standard forum established
Opencv实现颜色检测
!‘cat‘ 不是内部或外部命令,也不是可运行的程序 或批处理文件。
【LeetCode】12、整数转罗马数字
Simulation questions and answers of the latest national fire-fighting facility operators (primary fire-fighting facility operators) in 2022
Biovendor sRAGE protein solution
[csp-j2020] excellent splitting
并发之wait/notify说明
Study on chemical properties and technology of biovendor rage ELISA Kit
The latest examination questions and answers for the eight members (standard members) of Liaoning architecture in 2022
The number of small stores in Suning has dropped sharply by 428 in one year. Zhangkangyang, the son of Zhang Jindong, is the actual controller
gsap的简单用法
2022西式面点师(高级)考试试题模拟考试平台操作
电源插座是如何传输电的?困扰小伙伴这么多年的简单问题
It is the latest weapon to cross the blockade. It is one of the fastest ladders.
2022年低压电工考题及答案
Extjs图书管理系统源码 智能化图书管理系统源码
Pcr/qpcr research: lumiprobe dsgreen is used for real-time PCR
QCOM LCD调试