結果
| 問題 |
No.631 Noelちゃんと電車旅行
|
| コンテスト | |
| ユーザー |
yuruhiya
|
| 提出日時 | 2021-04-12 20:13:27 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 547 bytes |
| コンパイル時間 | 853 ms |
| コンパイル使用メモリ | 101,360 KB |
| 最終ジャッジ日時 | 2025-01-20 16:18:57 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:13:9: error: ‘cin’ was not declared in this scope
13 | cin >> n;
| ^~~
main.cpp:2:1: note: ‘std::cin’ is defined in header ‘<iostream>’; did you forget to ‘#include <iostream>’?
1 | #include <atcoder/all>
+++ |+#include <iostream>
2 | using namespace std;
main.cpp:24:17: error: ‘cout’ was not declared in this scope
24 | cout << seg.all_prod() << '\n';
| ^~~~
main.cpp:24:17: note: ‘std::cout’ is defined in header ‘<iostream>’; did you forget to ‘#include <iostream>’?
ソースコード
#include <atcoder/all>
using namespace std;
using ll = long long;
ll op(ll a, ll b) { return max(a, b); }
ll e() { return -8e18; }
ll ma(ll f, ll x) { return f + x; }
ll co(ll f, ll g) { return f + g; }
ll id() { return 0; }
int main() {
int n, m;
cin >> n;
vector<ll> v(n - 1);
for (int i = 0; i < n - 1; ++i) {
cin >> v[i];
v[i] += (n - i - 1) * 3;
}
atcoder::lazy_segtree<ll, op, e, ll, ma, co, id> seg(v);
for (cin >> m; m--;) {
ll l, r, d;
cin >> l >> r >> d;
seg.apply(l - 1, r, d);
cout << seg.all_prod() << '\n';
}
}
yuruhiya