QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#42296 | #1780. Intact Intervals | pskkk | Compile Error | / | / | C++17 | 1.9kb | 2022-08-01 21:05:04 | 2022-08-01 21:05:06 |
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 21:05:06]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2022-08-01 21:05:04]
- 提交
answer
#include <bits/stdc++.h>
#define F(i, l, r) for(int i = (l), _end_ = (int)(r); i <= _end_; ++i)
#define f(i, r, l) for(int i = (r), _end_ = (int)(l); i >= _end_; --i)
#define Set(a, v) memset(a, v, sizeof(a))
#define File(a) freopen("input.txt","r",stdin);freopen("output.txt","w",stdout)
using namespace std;
bool chkmin(int &a, int b) {return b < a ? a = b, 1 : 0;}
bool chkmax(int &a, int b) {return b > a ? a = b, 1 : 0;}
inline int read() {
int x = 0, fh = 1; char ch = getchar();
for (; !isdigit(ch); ch = getchar() ) if (ch == '-') fh = -1;
for (; isdigit(ch); ch = getchar() ) x = (x<<1) + (x<<3) + (ch ^ '0');
return x * fh;
}
int pw[1000005];
const int mod=1e9+7;
mt19937_64 rng(2333333),rng2(19260817);
vector<int>g;
int n;
int a[1000005], b[1000005];
unsigned long long val[1000005],val2[1000005];
unsigned long long psum[1000005],psum2[1000005];
unsigned long long qpow(unsigned long long x,unsigned long long y){
unsigned long long res=1;
while(y){
if(y&1)res=res*x;
x=x*x;
y>>=1;
}
return res;
}
void solve(){
n=read();
pw[0]=1;
F(i,1,n)a[i]=read(),g.push_back(a[i]),pw[i]=2ll*pw[i-1]%mod;
F(i,1,n)b[i]=read();
sort(g.begin(),g.end());
g.resize(unique(g.begin(),g.end())-g.begin());
F(i,1,n)a[i]=lower_bound(g.begin(),g.end(),a[i])-g.begin(),b[i]=lower_bound(g.begin(),g.end(),b[i])-g.begin();
F(i,0,g.size()-1)val[i]=,val2[i]=rng2();
map<pair<unsigned long long,unsigned long long>, int>cnt;
F(i,1,n){
psum[i]=psum[i-1]+qpow(998244353,val[a[i]])-qpow(998244353,val[b[i]]);
psum2[i]=psum2[i-1]+qpow(19260817,val2[a[i]])-qpow(19260817,val2[b[i]]);
cnt[{psum[i],psum2[i]}]++;
}
int res=0;
for(auto &p : cnt){
res=(res+pw[p.second]-p.second-1+mod)%mod;
}
printf("%d\n",res);
}
int main () {
#ifndef ONLINE_JUDGE
File();
#endif
int T=1;
// cin>>T;
while(T--){
solve();
}
return 0;
}
詳細信息
answer.code: In function ‘void solve()’: answer.code:41:33: error: expected primary-expression before ‘,’ token 41 | F(i,0,g.size()-1)val[i]=,val2[i]=rng2(); | ^