跳到正文

lcbridge

546681

可爱小企鹅

在洛谷打开
资料、奖项与版本

资料

编号
546681
抓取

大号:

小号:

对拍:

C++
#include <bits/stdc++.h>
#include <windows.h>
#define int long long
using namespace std;
signed main(){
	while(1){ 
		system("makedata.exe");
		system("myprogram.exe");
		system("tj.exe");
		if(system("fc myout.out ansout.out")){
			break;
		}
		cout<<"?\n";
	}
	return 0;
}
C++
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N=1e5+5;
const int inf=0x3f3f3f3f;
const int mod=1e9+7;
inline int read(){
	int f=1,x=0;
	char ch=getchar();
	while(ch<'0'||ch>'9'){
		if(ch=='-')f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		x=(x<<1)+(x<<3)+ch-48;
		ch=getchar();
	}
	return f*x;
}
int n;
signed main(){
	freopen("data.in","w",stdout);
	srand(time(0));
	n=rand()%15;
	n++;
	cout<<n<<"\n";
	for(int i=1;i<=n;i++){
		int x=rand()%n+2;
		cout<<x<<' '; 
	}
	cout<<"\n"<<10<<"\n";
	int tmp=10;
	while(tmp--){
		int op=rand()%2,u=rand()%n+1,v=rand()%n+1,w=rand()%n+2;
		if(u>v)swap(u,v);
		cout<<op<<' '<<u<<' '<<v<<' '<<w<<"\n";
	}
	return 0;
}
C++
#include <bits/stdc++.h>
#define int long long
using namespace std;

const int N=1e5+5;
const int inf=LONG_LONG_MAX-1;

inline int read(){
	int f=1,x=0;
	char ch=getchar();
	while(ch<'0'||ch>'9'){
		if(ch=='-')f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		x=(x<<1)+(x<<3)+ch-'0';
		ch=getchar();
	}
	return f*x;
}

int n,len,a[N],tmp,now=1;
int pos[N],tag[320],L[320],R[320];

vector <int> blk[320];

void add(int l,int r,int c){
	int p=pos[l],q=pos[r];
	if(p==q){
		blk[p].clear();
		for(int i=l;i<=r;i++)a[i]=c;
		for(int i=L[p];i<=R[p];i++)blk[p].push_back(a[i]);
		sort(blk[p].begin(),blk[p].end());
		return ;
	}
	for(int i=p+1;i<q;i++)tag[i]=c;
	blk[p].clear();
	for(int i=l;i<=R[p];i++)a[i]=c;
	for(int i=L[p];i<=R[p];i++)blk[p].push_back(a[i]);
	sort(blk[p].begin(),blk[p].end());
	blk[q].clear();
	for(int i=L[q];i<=r;i++)a[i]=c; 
	for(int i=L[q];i<=R[q];i++)blk[q].push_back(a[i]);
	sort(blk[q].begin(),blk[q].end());
}
int find1(int l,int r,int x,int k){
	int res=0;
	while(l<=r){
		int mid=(l+r)>>1;
		if(blk[k][mid]<=x){
			l=mid+1;
			res=mid; 
		}
		else r=mid-1;
	}
	return res;
}
int query(int l,int r,int x){
	int p=pos[l],q=pos[r],res=0;
	if(p==q){
		for(int i=l;i<=r;i++)if(a[i]<=x)res++;
		return res;
	}
	else {
	//	cout<<l<<' '<<r<<"\n"; 
		for(int i=l;i<=R[p];i++){
	//		cout<<a[i]<<"\n"; 
			if(a[i]<=x)res++;
		}
		for(int i=p+1;i<q;i++){
			if(tag[i]!=inf){
			//	cout<<"F "<<tag[i]<<"\n";
				if(tag[i]<=x)res+=(R[i]-L[i]+1);
			}
			else {
//				cout<<"F "<<i<<' ';
//				for(int j=L[3];j<=R[3];j++){
//					cout<<a[j]<<' ';
//				}
				int pos=find1(0,blk[i].size()-1,x,i);
				if(blk[i][pos]>x)pos--;
			//	cout<<pos<<"\n";
				res+=pos+1;
			}
		}
		for(int i=L[q];i<=r;i++){
		//	cout<<a[i]<<"\n";
			if(a[i]<=x)res++;
		}
		return res;
	}
}
int m;
signed main(){
	freopen("data.in","r",stdin);
	freopen("ansout.out","w",stdout);
	n=read();
	for(int i=1;i<=n;i++)a[i]=read();
	m=read();
	while(m--){
		int op=read(),l=read(),r=read(),c=read();
		if(!op){
			for(int i=l;i<=r;i++)a[i]=c;
		}
		else {
			int res=0;
			for(int i=l;i<=r;i++){
				res+=(a[i]<=c);
			}
			cout<<res<<"\n"; 
		}
	}
	return 0;
}

http://yuantiji.ac/zh/

http://lboj.com.cn/upload/px.lboj.com.cn/file/20230226/20230226104353_50284.zip

nipple

dick

查重题

QQ文档

BZOJ数据

Chat-gpt

VPN

建图

八下历史书

谷歌地图

LNBS_C2025_36 49619

C++
#include <bits/stdc++.h>
#define int long long 
#define pii pair<int,int>
#define mk make_pair
#define ft first
#define sd second
using namespace std;
const int N=1e5+5,V=1e6;
const int inf=0x3f3f3f3f,mod=1e9+7;
inline int read(){	
	char ch=getchar();
	int s=0,f=1;	
	while(!isdigit(ch)){if(ch=='-') f=-1;ch=getchar();}	
	while(isdigit(ch)){s=(s<<3)+(s<<1)+(ch^48);ch=getchar();}	
	return s*f;
}
signed main(){


	return 0;
}  

NKOJ生存必备技巧

C++
namespace fastIO {
#ifdef ONLINE_JUDGE
	const int SIZE = 1 << 20;
	char in[SIZE], out[SIZE], *p1 = in, *p2 = in, *p3 = out;
#define getchar() (p1 == p2 && (p2 = (p1 = in) + fread(in, 1, SIZE, stdin), p1 == p2) ? EOF : *p1 ++ )
#define flush() (fwrite(out, 1, p3 - out, stdout))
#define putchar(x) (p3 == out + SIZE && (flush(), p3 = out), *p3 ++ = (x))
	class Flush {
		public:
			~Flush() {
				flush();
			}
	} _;
#endif
	template<typename Type>
	inline Type read(Type &x) {
		x = 0;
		bool flag(0);
		char c = getchar();
		while (!isdigit(c)) flag ^= (c == '-'), c = getchar();
		while (isdigit(c)) x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
		return flag ? x = -x : x;
	}
	template<typename Type>
	inline void write(Type x) {
		x < 0 ? x = -x, putchar('-') : 0;
		static short Stack[35], top(0);
		do Stack[ ++ top] = x % 10, x /= 10;
		while (x);
		while (top) putchar(Stack[top -- ] | 48);
	}
	inline char read(char &x) {
		do x = getchar();
		while (isspace(x));
		return x;
	}
	inline int read(char *x) {
		static char *c = x;
		while (!isspace(*c = getchar()) && *c != EOF) c ++ ;
		*c = '\0';
		return c - x;
	}
	inline char write(const char &x) {
		return putchar(x);
	}
	template<typename Type> inline void write(Type *x) {
		while (*x) putchar(*x ++ );
	}
	template<typename Type, typename ...Args> inline void read(Type &x, Args &...y) {
		read(x), read(y...);
	}
	template<typename Type, typename ...Args> inline void write(const Type &x, const Args &...y) {
		write(x), putchar(' '), write(y...), sizeof...(y) ^ 1 ? 0 : putchar('\n');
	}
	template<typename Type>	inline void write(const Type &x, char c) {
		write(x), putchar(c);
	}
#ifdef ONLINE_JUDGE
#undef getchar
#undef flush
#undef putchar
#endif
}
using namespace fastIO;

定义笛卡尔树

还没有收录这位用户的文章。