QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#828207 | #9774. Same Sum | ucup-team5243 | Compile Error | / | / | C++23 | 1.6kb | 2024-12-23 14:38:38 | 2024-12-23 14:38:40 |
Judging History
你现在查看的是最新测评结果
- [2025-01-11 11:59:18]
- hack成功,自动添加数据
- (/hack/1443)
- [2024-12-23 17:02:06]
- hack成功,自动添加数据
- (/hack/1310)
- [2024-12-23 16:48:26]
- hack成功,自动添加数据
- (/hack/1309)
- [2024-12-23 16:33:45]
- hack成功,自动添加数据
- (/hack/1308)
- [2024-12-23 16:23:53]
- hack成功,自动添加数据
- (/hack/1307)
- [2024-12-23 16:13:08]
- hack成功,自动添加数据
- (/hack/1306)
- [2024-12-23 15:54:42]
- hack成功,自动添加数据
- (/hack/1305)
- [2024-12-23 14:58:39]
- hack成功,自动添加数据
- (/hack/1304)
- [2024-12-23 14:38:40]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2024-12-23 14:38:38]
- 提交
answer
#include <cplib/tmpl/sheep.hpp>
#include <atcoder/lazysegtree>
using namespace atcoder;
using i128 = __int128_t;
i128 P = 2305843009213693951;
i128 B = 1000000007;
i128 pow128(i128 a, i128 n) {
i128 res = 1;
while (n > 0) {
if (n & 1) res = (res * a) % P;
if (n > 1) a = (a * a) % P;
n >>= 1;
}
return res;
}
i128 invB = 162220979843304191LL;
struct Node {
ll mn;
ll mx;
ll siz;
i128 hp;
i128 hm;
Node(ll a,ll b,ll c,i128 d,i128 e) : mn(a),mx(b),siz(c),hp(d),hm(e) {}
};
Node op(Node x,Node y){
return Node(min(x.mn,y.mn),max(x.mx,y.mx),x.siz+y.siz,(x.hp+y.hp)%P,(x.hm+y.hm)%P);
}
Node e(){
return Node(INF,-INF,0,0,0);
}
Node mapping(ll f,Node x){
return Node(x.mn+f,x.mx+f,x.siz,(x.hp)*pow128(B,f)%P,(x.hm)*pow128(invB,f)%P);
}
ll composition(ll f,ll g){
return f+g;
}
ll id(){
return 0;
}
int main(){
ii(N,Q);
li(A,N);
vector<Node> tmp;
rep(i,N){
tmp.push_back(Node(A[i],A[i],1,pow128(B,A[i]),pow128(invB,A[i])));
}
lazy_segtree<Node, op, e, ll, mapping, composition, id> seg(tmp);
rep(i,Q){
ii(t);
if(t==1){
ii(l,r,x);
seg.apply(l-1,r,x);
}else{
ii(l,r);
Node ans = seg.prod(l-1,r);
//cout << ans.mx << " " << ans.mn << endl;
//cout << (ll) ans.hp << " " << (ll) ans.hm << endl;
ll m = (ans.mx+ans.mn);
YES(ans.hp == (ans.hm*pow128(B,m))%P);
}
}
return 0;
}
詳細信息
answer.code:1:10: fatal error: cplib/tmpl/sheep.hpp: No such file or directory 1 | #include <cplib/tmpl/sheep.hpp> | ^~~~~~~~~~~~~~~~~~~~~~ compilation terminated.