結果
| 問題 | No.3507 RangeSum RangeUpdate RangeSqrt |
| コンテスト | |
| ユーザー |
AK_Mi
|
| 提出日時 | 2026-04-21 21:36:23 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,736 bytes |
| 記録 | |
| コンパイル時間 | 6,442 ms |
| コンパイル使用メモリ | 383,540 KB |
| 実行使用メモリ | 218,880 KB |
| 最終ジャッジ日時 | 2026-04-21 21:38:24 |
| 合計ジャッジ時間 | 33,610 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 1 WA * 14 TLE * 14 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using mint = modint998244353;
ll vsize = 32;
struct S{
vector<ll> value;
int size;
};
struct F{
ll ch;
ll sq;
};
const F ID = {-1,0};
S op(S a, S b){
vector<ll> c(vsize,1);
for(ll i = 0; i < vsize; i++){
c[i] = a.value[i] + b.value[i];
}
return {c, a.size+b.size};
}
S e(){
return {vector<ll>(vsize,0),0};
}
S mapping(F f, S x){
if(f.ch != -1){
x.value[0] = f.ch;
for(ll i = 1; i < vsize; i++){
x.value[i] = sqrtl(x.value[i-1]);
}
}
for(ll i = 0; i < vsize; i++){
if(i + f.sq < vsize){
x.value[i] = x.value[i + f.sq];
}else{
x.value[i] = x.size;
}
}
return x;
}
F composition(F f, F g){
F ret;
if(f.ch != -1)ret = f;
else ret = {g.ch, f.sq + g.sq};
return ret;
}
F id(){ return ID; }
int main(){
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
ll n,q;
cin >> n >> q;
vector<ll> a(n,0);
lazy_segtree<S, op, e, F, mapping, composition, id> seg(n);
vector<ll> vec(vsize,1);
for(ll i = 0; i < n; i++){
cin >> a[i];
vec[0] = a[i];
for(ll t = 1; t < vsize; t++){
vec[t] = sqrtl(vec[t-1]);
}
seg.set(i,{vec,1});
}
ll que,l,r,x;
while(q--){
cin >> que >> l >> r;
if(que == 0){
cout << seg.prod(l,r).value[0] << '\n';
}else if(que == 1){
cin >> x;
seg.apply(l,r,{x,0});
}else{
seg.apply(l,r,{-1,1});
}
}
}
AK_Mi