QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#570064#7992. 【模板】线段树liaoyanxuCompile Error//C++142.6kb2024-09-17 13:38:172024-09-17 13:38:20

Judging History

你现在查看的是最新测评结果

  • [2024-09-17 13:38:20]
  • 评测
  • [2024-09-17 13:38:17]
  • 提交

answer

\#include <bits/stdc++.h>
using namespace std;
#define S cerr << "SYT AK IOI" <<endl;
#define M cerr << "MKF AK IOI" <<endl;
#define CONNECT_BASE(x,y) x##y
#define CONNECT(x,y) CONNECT_BASE(x,y)
#define DEBUG_BASE(x) cerr<<#x<<'='<<x<<' '
#define DEB_1(x) DEBUG_BASE(x)
#define DEB_2(x,y) DEB_1(x),DEB_1(y)
#define DEB_3(x,y,z) DEB_1(x),DEB_2(y,z)
#define DEB_4(x,y,z,w) DEB_1(x),DEB_3(y,z,w)
#define DEB_5(a,b,c,d,e) DEB_1(a),DEB_4(b,c,d,e)
#define DEB_6(a,b,c,d,e,f) DEB_1(a),DEB_5(b,c,d,e,f)
#define COUNT_BASE(_1,_2,_3,_4,_5,_6,x,...) x
#define COUNT(...) COUNT_BASE(__VA_ARGS__,6,5,4,3,2,1,0)
#define D(...) std::cerr << "[In Line " << __LINE__ << "]: ",CONNECT(DEB_,COUNT(__VA_ARGS__))(__VA_ARGS__) , cerr << '\n'
using ll=long long;
using lll=__int128;
using pii=pair<int,int>;
using uint=unsigned int;
using ull=unsigned long long;
#define pb(x) push_back(x)
#define F(i,a,b) for(int i=(a),i##end=(b);i<=(i##end);++i)
#define UF(i,a,b) for(int i=(a),i##end=(b);i>=(i##end);--i)
int n,m;
const int N=2e5+5;
uint a[N];
uint mul[1145][21];
uint tag[1145];
const int mod=1<<20;
int len=314;
namespace BLK{
	inline int bl(int x){
		return (x-1)/len+1;
	}
	inline int L(int id){
		return len*(id-1)+1;
	}
	inline int R(int id){
		return min(n,len*id);
	}
	inline void rebuild(int id){
		F(i,1,20)mul[id][i]=0;
		mul[id][1]=1;
		F(i,L(id),R(id)){
			UF(j,20,1)mul[id][j]=mul[id][j]*a[i]+mul[id][j-1];
		}
	}
	inline void build(){
		F(i,1,n)if(bl(i)!=bl(i-1))rebuild(bl(i));
	}
	inline void push_down(int id){
		if(!tag[id])return;
		F(i,L(id),R(id))a[i]+=tag[id];
		tag[id]=0;
		rebuild(id);
	}
	inline void add(int l,int r,uint k){
		if(bl(l)==bl(r)){
			push_down(bl(l));
			F(i,l,r)a[i]+=k;
			rebuild(bl(l));
			return;
		}
		push_down(bl(l));
		F(i,l,R(bl(l)))a[i]+=k;
		rebuild(bl(l));
		push_down(bl(r));
		F(i,L(bl(r)),r)a[i]+=k;
		rebuild(bl(r));
		F(i,bl(l)+1,bl(r)-1)tag[i]+=k;
	}
	inline uint query(int l,int r){
		uint rt=1;
		if(bl(l)==bl(r)){
			push_down(bl(l));
			F(i,l,r)rt*=a[i];
			return rt;
		}
		push_down(bl(l));
		F(i,l,R(bl(l)))rt*=a[i];
		rebuild(bl(l));
		push_down(bl(r));
		F(i,L(bl(r)),r)rt*=a[i];
		F(i,bl(l)+1,bl(r)-1){
			uint tmp=1;
			uint ml=0,cnt=1;
			while(tmp%mod){
				ml=ml+tmp*mul[i][cnt];
				tmp*=tag[i];
				++cnt;
			}
			rt*=ml;
		}
		return rt;
	}
}
using namespace BLK;
int main(){
	cin.tie(nullptr)->sync_with_stdio(false);
	cin>>n>>m;
	F(i,1,n)cin>>a[i];
	build();
	F(i,1,m){
		int op,l,r;
cin>>op>>l>>r;
		if(op==1){
			uint k;
cin>>k;
			add(l,r,k);
		}
		else {
			cout<<query(l,r)%mod<<'\n';
		}
	}
	return 0;
}

Details

answer.code:1:1: error: stray ‘\’ in program
    1 | \#include <bits/stdc++.h>
      | ^
answer.code:1:2: error: stray ‘#’ in program
    1 | \#include <bits/stdc++.h>
      |  ^
answer.code:1:3: error: ‘include’ does not name a type
    1 | \#include <bits/stdc++.h>
      |   ^~~~~~~
answer.code:19:11: error: ‘pair’ does not name a type
   19 | using pii=pair<int,int>;
      |           ^~~~
answer.code: In function ‘int BLK::R(int)’:
answer.code:40:24: error: ‘min’ was not declared in this scope
   40 |                 return min(n,len*id);
      |                        ^~~
answer.code: In function ‘int main()’:
answer.code:100:9: error: ‘cin’ was not declared in this scope
  100 |         cin.tie(nullptr)->sync_with_stdio(false);
      |         ^~~
answer.code:113:25: error: ‘cout’ was not declared in this scope
  113 |                         cout<<query(l,r)%mod<<'\n';
      |                         ^~~~