結果
問題 |
No.3265 地元に帰れば天才扱い!
|
ユーザー |
![]() |
提出日時 | 2025-08-10 11:04:48 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,524 bytes |
コンパイル時間 | 6,954 ms |
コンパイル使用メモリ | 333,856 KB |
実行使用メモリ | 14,688 KB |
最終ジャッジ日時 | 2025-09-06 12:32:18 |
合計ジャッジ時間 | 14,469 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 RE * 3 |
other | RE * 21 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using ull = unsigned long long; #define rep(i,n) for(ll i=0;i<n;++i) #define all(a) (a).begin(),(a).end() ll intpow(ll a, ll b){ ll ans = 1; while(b){ if(b & 1) ans *= a; a *= a; b /= 2; } return ans; } ll modpow(ll a, ll b, ll p){ ll ans = 1; while(b){ if(b & 1) (ans *= a) %= p; (a *= a) %= p; b /= 2; } return ans; } template<class T> T div_floor(T a, T b) { return a / b - ((a ^ b) < 0 && a % b); } template<class T> T div_ceil(T a, T b) { return a / b + ((a ^ b) > 0 && a % b); } template <typename T, typename U> inline bool chmin(T &x, U y) { return (y < x) ? (x = y, true) : false; } template <typename T, typename U> inline bool chmax(T &x, U y) { return (x < y) ? (x = y, true) : false; } #include <atcoder/all> using namespace atcoder; using mint = modint998244353; void solve() { ll N; cin>>N; vector<ll> A(N); rep(i,N)cin>>A[i]; auto op=[](ll x,ll y)->ll { return x+y; }; auto e=[]()->ll { return 0LL; }; segtree<ll,op,e> STA(A),STS(N+1); ll Q; cin>>Q; ll ans=0; rep(_,Q){ ll x,y,l,r; cin>>x>>y>>l>>r; l--; x--; ll s=STS.prod(0,x+1); ans+=(y-STA.get(x))*s; STA.set(x,y); ans+=STA.prod(l,r); STS.set(l,STS.get(l)+1); STS.set(r,STS.get(r)-1); cout<<ans<<endl; } return; } int main() { ll T=1; while (T--){ solve(); } return 0; }