結果
| 問題 | No.3411 Range Clamp Sum |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-12-17 19:44:07 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 1,575 ms / 10,000 ms |
| コード長 | 879 bytes |
| 記録 | |
| コンパイル時間 | 3,561 ms |
| コンパイル使用メモリ | 251,360 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2025-12-17 23:39:23 |
| 合計ジャッジ時間 | 22,379 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 28 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) begin(x), end(x)
const int INF = 1e9;
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
ll N, Q;
cin >> N >> Q;
vector<ll> A(N);
rep(i, N) cin >> A[i];
rep(i, Q)
{
ll t;
cin >> t;
if (t == 1)
{
ll x, y;
cin >> x >> y;
A[x - 1] = y;
}
else
{
ll l, r, a, b;
cin >> l >> r >> a >> b;
ll ans = 0;
for (int i = l - 1; i < r; i++)
{
ans += max(a, min(b, A[i]));
}
cout << ans << endl;
}
}
return 0;
}