結果

問題 No.631 Noelちゃんと電車旅行
コンテスト
ユーザー ooaiu
提出日時 2026-08-23 15:44:12
言語 C++23
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 129 ms / 2,000 ms
+ 326µs
コード長 658 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,884 ms
コンパイル使用メモリ 337,040 KB
実行使用メモリ 7,424 KB
最終ジャッジ日時 2026-08-23 15:44:23
合計ジャッジ時間 6,937 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
#include <atcoder/lazysegtree>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
using ll = long long;
ll op(ll a, ll b) { return max(a,b);}
ll e() {return -1e18;}
ll comp(ll f, ll g) { return f+g;}
ll mapp(ll f, ll x) { return f + x; }
ll id() { return 0; }
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int N;
	cin >> N;
	vector<ll>T(N-1);
	rep(i,N-1)cin>>T[i];
	rep(i,N-1)T[i] -= 3 * (i+1);
	atcoder::lazy_segtree<ll,op,e,ll,mapp,comp,id> seg(T);
	int M;cin>>M;
	rep(i,M){
		int l, r, d;
		cin >> l >> r >> d;
		l--;
		seg.apply(l,r,d);
		ll ans = seg.all_prod() + 3 * N;
		cout<<ans<<endl;
	}
}
0