too short求调
  • 板块P5026 Lycanthropy
  • 楼主lrx___
  • 当前回复2
  • 已保存回复2
  • 发布时间2024/8/9 08:45
  • 上次更新2024/8/9 09:45:10
查看原帖
too short求调
989792
lrx___楼主2024/8/9 08:45
// #define ___coding

#ifdef ___coding
#define ___coding1 true
#else
#define ___coding1 false
#endif
#include<cmath>
#include<cassert>
#include<cctype>
#include<climits>
#include<cstdlib>
#include<cstdio>
#include<cstring>
#include<ctime>

// #include<algorithm>
// using std::__gcd;
// using std::lower_bound;
// using std::max;
// using std::min;
// using std::next_permutation;
// using std::reverse;
// using std::sort;
// using std::swap;
// using std::unique;
// using std::upper_bound;

// #include<bitset>
// using std::bitset;

// #include<deque>
// using std::deque;

// #include<fstream>
// using std::ifstream;
// using std::ofstream;

// #include<iomanip>
// using std::fixed;
// using std::setprecision;

// #include<iostream>
// using std::cin;
// using std::cout;
// using std::ios;

// #include<list>
// using std::list;

// #include<map>
// using std::map;

// #include<memory>
// using std::make_shared;
// using std::make_unique;
// using std::shared_ptr;
// using std::unique_ptr;

// #include<queue>
// using std::priority_queue;
// using std::queue;

// #include<stack>
// using std::stack;

// #include<set>
// using std::multiset;
// using std::set;

// #include<sstream>
// using std::stringstream;

// #include<string>
// using std::getline;
// using std::string;
// using std::to_string;

// #include<utility>
// using std::make_pair;
// using std::pair;

// #include<unordered_map>
// using std::unordered_map;

// #include<unordered_set>
// using std::unordered_set;

// #include<vector>
// using std::vector;
#define UP(i,a,b) for(i=a;i<=(b);++i)
#define DN(i,a,b) for(i=a;i>=(b);--i)
#define up(i,a,b) for(i=a;i<(b);++i)
#define dn(i,a,b) for(i=a;i>(b);--i)
#define pr make_pair
typedef unsigned char unc;
typedef unsigned short uns;
typedef unsigned uni;
typedef unsigned long unl;
typedef long long ll;
typedef unsigned long long ull;
const int BUF_SIZE(1<<20);
bool ___f;
char ___c,___a[45],*___p,___ibuf[BUF_SIZE+1],*___ib(___ibuf),*___ie(___ibuf),___obuf[BUF_SIZE+1],*___ob(___obuf),*___oe(___obuf+BUF_SIZE);
char& gtch(){if(___ib==___ie)___ie=(___ib=___ibuf)+fread(___ibuf,1,BUF_SIZE,stdin);if(___ib==___ie){return *___ibuf=-1;}return *___ib++;}
void ___flush(){fwrite(___obuf,1,___ob-___obuf,stdout);___ob=___obuf;}
void ptch(char c){if(___ob==___oe)___flush();*___ob=c;++___ob;}
typedef __int128 pll;
typedef unsigned __int128 upll;
void rd(pll &r){r=0;___f=false;for(___c=gtch();___c<'0'||___c>'9';___c=gtch()){___f=(___c=='-');}for(;___c>='0'&&___c<='9';___c=gtch()){r=(r<<3)+(r<<1)+(___c^'0');}if(___f){r=~(r-1);}}
void rd(upll &r){r=0;for(___c=gtch();___c<'0'||___c>'9';___c=gtch());for(;___c>='0'&&___c<='9';___c=gtch()){r=(r<<3)+(r<<1)+(___c^'0');}}
void wt(pll r){if(!r){ptch('0');return;}if(r<0){ptch('-');r=~(r-1);}___p=___a;while(r!=0){++___p;*___p=char(r%10)^'0';r/=10;}while(___p!=___a){ptch(*___p);--___p;}}
void wt(upll r){if(!r){ptch('0');return;}___p=___a;while(r!=0){++___p;*___p=char(r%10)^'0';r/=10;}while(___p!=___a){ptch(*___p);--___p;}}
void rd(bool &r){r=false;for(___c=gtch();___c<'0'||___c>'9';___c=gtch());for(;___c>='0'&&___c<='9';___c=gtch()){r|=bool(___c^'0');}}
void rd(char &c){for(c=gtch();c==' '||c=='\r'||c=='\n';c=gtch());}
void rd(short &r){r=0;___f=false;for(___c=gtch();___c<'0'||___c>'9';___c=gtch()){___f=(___c=='-');}for(;___c>='0'&&___c<='9';___c=gtch()){r=(r<<3)+(r<<1)+(short)(___c^'0');}if(___f){r=~(r-1);}}
void rd(int &r){r=0;___f=false;for(___c=gtch();___c<'0'||___c>'9';___c=gtch()){___f=(___c=='-');}for(;___c>='0'&&___c<='9';___c=gtch()){r=(r<<3)+(r<<1)+(___c^'0');}if(___f){r=~(r-1);}}
void rd(long &r){r=0;___f=false;for(___c=gtch();___c<'0'||___c>'9';___c=gtch()){___f=(___c=='-');}for(;___c>='0'&&___c<='9';___c=gtch()){r=(r<<3)+(r<<1)+(___c^'0');}if(___f){r=~(r-1);}}
void rd(ll &r){r=0;___f=false;for(___c=gtch();___c<'0'||___c>'9';___c=gtch()){___f=(___c=='-');}for(;___c>='0'&&___c<='9';___c=gtch()){r=(r<<3)+(r<<1)+(___c^'0');}if(___f){r=~(r-1);}}
void rd(unc &c){for(c=gtch();c==' '||c=='\r'||c=='\n';c=gtch());}
void rd(uns &r){r=0;for(___c=gtch();___c<'0'||___c>'9';___c=gtch());for(;___c>='0'&&___c<='9';___c=gtch()){r=(r<<3)+(r<<1)+(uns)(___c^'0');}}
void rd(uni &r){r=0;for(___c=gtch();___c<'0'||___c>'9';___c=gtch());for(;___c>='0'&&___c<='9';___c=gtch()){r=(r<<3)+(r<<1)+(___c^'0');}}
void rd(unl &r){r=0;for(___c=gtch();___c<'0'||___c>'9';___c=gtch());for(;___c>='0'&&___c<='9';___c=gtch()){r=(r<<3)+(r<<1)+(___c^'0');}}
void rd(ull &r){r=0;for(___c=gtch();___c<'0'||___c>'9';___c=gtch());for(;___c>='0'&&___c<='9';___c=gtch()){r=(r<<3)+(r<<1)+(___c^'0');}}
void rd(char *s){for(*s=gtch();*s==' '||*s=='\r'||*s=='\n';*s=gtch());for(;~*s&&*s!=' '&&*s!='\r'&&*s!='\n';++s,*s=gtch());*s=0;}
void rd(char *s,char n){for(*s=gtch();*s==' '||*s=='\r'||*s=='\n';*s=gtch());for(;~*s&&*s!=n;++s,*s=gtch());*s=0;}
void wt(bool a){ptch('0'+a);}
void wt(char c){ptch(c);}
void wt(short r){if(!r){ptch('0');return;}if(r<0){ptch('-');r=~(r-1);}___p=___a;while(r!=0){++___p;*___p=char(r%10)^'0';r/=10;}while(___p!=___a){ptch(*___p);--___p;}}
void wt(int r){if(!r){ptch('0');return;}if(r<0){ptch('-');r=~(r-1);}___p=___a;while(r!=0){++___p;*___p=char(r%10)^'0';r/=10;}while(___p!=___a){ptch(*___p);--___p;}}
void wt(long r){if(!r){ptch('0');return;}if(r<0){ptch('-');r=~(r-1);}___p=___a;while(r!=0){++___p;*___p=char(r%10)^'0';r/=10;}while(___p!=___a){ptch(*___p);--___p;}}
void wt(ll r){if(!r){ptch('0');return;}if(r<0){ptch('-');r=~(r-1);}___p=___a;while(r!=0){++___p;*___p=char(r%10)^'0';r/=10;}while(___p!=___a){ptch(*___p);--___p;}}
void wt(unc c){ptch(c);}
void wt(uns r){if(!r){ptch('0');return;}___p=___a;while(r!=0){++___p;*___p=char(r%10)^'0';r/=10;}while(___p!=___a){ptch(*___p);--___p;}}
void wt(uni r){if(!r){ptch('0');return;}___p=___a;while(r!=0){++___p;*___p=char(r%10)^'0';r/=10;}while(___p!=___a){ptch(*___p);--___p;}}
void wt(unl r){if(!r){ptch('0');return;}___p=___a;while(r!=0){++___p;*___p=char(r%10)^'0';r/=10;}while(___p!=___a){ptch(*___p);--___p;}}
void wt(ull r){if(!r){ptch('0');return;}___p=___a;while(r!=0){++___p;*___p=char(r%10)^'0';r/=10;}while(___p!=___a){ptch(*___p);--___p;}}
void wt(char *s){for(;*s;++s){ptch(*s);}}
void wt(const char *s){for(;*s;++s){ptch(*s);}}
template<typename T,typename ...T1>void rd(T &a,T1 &...b){rd(a);rd(b...);}
template<typename T,typename ...T1>void wt(T a,T1 ...b){wt(a);wt(b...);}
template<typename T>void RD(T* a,int n=1){while(n--){rd(*a);++a;}}
ll llabs1(ll a){return a<0?-a:a;}
template<typename T>T ___min(T &a,T &b){return a<b?a:b;}
template<typename T,typename ...T1>T ___min(T &a,T &b,T1 &...c){return ___min(a,b=___min(b,c...));}
template<typename ...T>auto min(T ...a){return ___min(a...);}
template<typename T>T ___max(T &a,T &b){return a>b?a:b;}
template<typename T,typename ...T1>T ___max(T &a,T &b,T1 &...c){return ___max(a,b=___max(b,c...));}
template<typename ...T>auto max(T ...a){return ___max(a...);}
/*

*/
const int N(1e6+5);
int n,m;
template<int l,int r>
struct p_array{
	int a[r-l+1];
	int& operator[](int k){
		return a[k-l];
	}
	p_array(){memset(a,0,sizeof a);}
};
p_array< -1000005,2000005> cha;

void update1(int l,int r,int k){
	cha[l]+=k;
	cha[r+1]-=k;
}
void update(int v,int x){
	update1(x-v*3+1,x-(v<<1),1);
	update1(x-(v<<1)+1,x,-1);
	update1(x+1,x+(v<<1),1);
	update1(x+(v<<1)+1,x+v*3,-1);
}
void main1(){
	int i,v,x;
	rd(n,m);
	UP(i,1,n){
		rd(v,x);
		update(v,x);
	}
	UP(i,-1000000,200000){
		cha[i]+=cha[i-1];
	}
	UP(i,-1000000,200000){
		cha[i]+=cha[i-1];
		if(1<=i&&i<=m){
			wt(cha[i]," \n"[i==m]);
		}
	}
}
int main(){if(___coding1)freopen("in.txt","r",stdin);main1();___flush();if(___coding1){freopen("CON","r",stdin);system("pause");}return 0;}

2024/8/9 08:45
加载中...