QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#42284#1780. Intact IntervalsStargazerCompile Error//C++2.3kb2022-08-01 20:46:342022-08-01 20:46:35

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-08-01 20:46:35]
  • 评测
  • [2022-08-01 20:46:34]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define cs const
#define re register
#define pb push_back
#define pii pair<int,int>
#define ll long long
#define y1 shinkle
#define fi first
#define se second
#define bg begin
namespace IO{

cs int RLEN=1<<22|1;
char ibuf[RLEN],*ib,*ob;
inline char gc(){
    (ib==ob)&&(ob=(ib=ibuf)+fread(ibuf,1,RLEN,stdin));
    return (ib==ob)?EOF:*ib++;
}
inline int read(){
    char ch=gc();
    int res=0;bool f=1;
    while(!isdigit(ch))f^=ch=='-',ch=gc();
    while(isdigit(ch))res=(res*10)+(ch^48),ch=gc();
    return f?res:-res;
}
inline ll readll(){
    char ch=gc();
    ll res=0;bool f=1;
    while(!isdigit(ch))f^=ch=='-',ch=gc();
    while(isdigit(ch))res=(res*10)+(ch^48),ch=gc();
    return f?res:-res;
}
inline char readchar(){
	char ch=gc();
	while(isspace(ch))ch=gc();
	return ch;
}
inline int readstring(char *s){
	int top=0;char ch=gc();
	while(isspace(ch))ch=gc();
	while(!isspace(ch)&&ch!=EOF)s[++top]=ch,ch=gc();
	s[top+1]='\0';return top;
}

}
using IO::read;
using IO::readll;
using IO::readchar;
using IO::readstring;
cs int mod=1e9+7;
inline int add(int a,int b){return (a+b)>=mod?(a+b-mod):(a+b);}
inline int dec(int a,int b){return (a<b)?(a-b+mod):(a-b);}
inline int mul(int a,int b){static ll r;r=(ll)a*b;return (r>=mod)?(r%mod):r;}
inline void Add(int &a,int b){a=(a+b)>=mod?(a+b-mod):(a+b);}
inline void Dec(int &a,int b){a=(a<b)?(a-b+mod):(a-b);}
inline void Mul(int &a,int b){static ll r;r=(ll)a*b;a=(r>=mod)?(r%mod):r;}
inline int ksm(int a,int b,int res=1){for(;b;b>>=1,Mul(a,a))(b&1)&&(Mul(res,a),1);return res;}
inline int Inv(int x){return ksm(x,mod-2);}
inline int fix(ll x){x%=mod;return (x<0)?x+mod:x;}
#define ull unsigned long long
ull ksm(ull a,int b){
    ull res=1;
    for(;b;b>>=1,a=a*a)if(b&1)res=res*a;return res;
}
map<ull,int> vs;
cs int N=2000005;
ull pre[N];
int a[N],b[N],n;
int main(){
    #ifdef Stargazer
    freopen("1.in","r",stdin);
    #endif
    n=read();
    for(int i=1;i<=n;i++)a[i]=a[i+n]=read();
    for(int i=1;i<=n;i++)b[i]=b[i+n]=read();
    int res=0;vs[0]=1;
    for(int i=1;i<2*n;i++){
        pre[i]=pre[i-1]+ksm(1e9+7,a[i])-ksm(1e9+7,b[i]);
        if(i>=n){
            Add(res,ksm(2,vs[pre[i]]-1)-1);
            vs[pre[i-n]]--;
        }
        if(i<n)vs[pre[i]]++;
    }cout<<res<<'\n';
    return 0;
}

Details

answer.code: In function ‘int main()’:
answer.code:79:28: error: call of overloaded ‘ksm(double, int&)’ is ambiguous
   79 |         pre[i]=pre[i-1]+ksm(1e9+7,a[i])-ksm(1e9+7,b[i]);
      |                         ~~~^~~~~~~~~~~~
answer.code:58:12: note: candidate: ‘int ksm(int, int, int)’
   58 | inline int ksm(int a,int b,int res=1){for(;b;b>>=1,Mul(a,a))(b&1)&&(Mul(res,a),1);return res;}
      |            ^~~
answer.code:62:5: note: candidate: ‘long long unsigned int ksm(long long unsigned int, int)’
   62 | ull ksm(ull a,int b){
      |     ^~~
answer.code:79:44: error: call of overloaded ‘ksm(double, int&)’ is ambiguous
   79 |         pre[i]=pre[i-1]+ksm(1e9+7,a[i])-ksm(1e9+7,b[i]);
      |                                         ~~~^~~~~~~~~~~~
answer.code:58:12: note: candidate: ‘int ksm(int, int, int)’
   58 | inline int ksm(int a,int b,int res=1){for(;b;b>>=1,Mul(a,a))(b&1)&&(Mul(res,a),1);return res;}
      |            ^~~
answer.code:62:5: note: candidate: ‘long long unsigned int ksm(long long unsigned int, int)’
   62 | ull ksm(ull a,int b){
      |     ^~~