hack
查看原帖
hack
654546
qczrz6v4nhp6u楼主2024/5/19 17:00

我的做法是用一个 set 存 ai×bi≤105a_i\times b_i\le 10^5 的位置,然后操作一扫描 [l,r][l,r] 内 ≤k\le k 的位置进行修改。显然复杂度是错误的(一个数可能扫到了但不修改),但是可能因为 kk 较大,能够飞快通过。

给出一个 gen:

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int n=100000,m=100000;
mt19937_64 rnd(time(0));
inline ll get(ll l,ll r){return rnd()%(r-l+1)+l;}
int main(){
	freopen("test.in","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	cout<<n<<' '<<m<<'\n';
	for(int i=1;i<=n;i++)cout<<get(1,100)<<" \n"[i==n];
	for(int i=1;i<=n;i++)cout<<get(1,100)<<" \n"[i==n];
	while(--m){
		int op=get(1,2);
		cout<<op<<' ';
		if(op==1){
			int l=get(1,500),r=get(99500,100000),k=get(1,100),t=get(1,10);
			cout<<l<<' '<<r<<' '<<k<<' '<<t<<'\n';
		}
		else{
			int i=get(1,n),x=get(1,100),y=get(1,100);
			cout<<i<<' '<<x<<' '<<y<<'\n';
		}
	}
	cout<<3<<' '<<1<<' '<<100000<<'\n';
	return 0;
}
2024/5/19 17:00
加载中...