結果
| 問題 |
No.2150 Site Supporter
|
| コンテスト | |
| ユーザー |
t33f
|
| 提出日時 | 2022-12-07 00:22:44 |
| 言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 369 bytes |
| コンパイル時間 | 1,592 ms |
| コンパイル使用メモリ | 84,124 KB |
| 最終ジャッジ日時 | 2025-02-09 05:53:12 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:12:9: error: 'tie' was not declared in this scope
12 | tie(s, t) = make_pair(min(s + k, t + k + x), min(s, t) + a[i]);
| ^~~
main.cpp:3:1: note: 'std::tie' is defined in header '<tuple>'; did you forget to '#include <tuple>'?
2 | #include <iostream>
+++ |+#include <tuple>
3 | using namespace std;
ソースコード
#include <vector>
#include <iostream>
using namespace std;
int main() {
int n; cin >> n;
long long k, x; cin >> k >> x;
vector<int> a(n);
for (int i = 0; i < n; i++) cin >> a[i];
long long s = x, t = 0;
for (int i = 0; i < n; ++i) {
tie(s, t) = make_pair(min(s + k, t + k + x), min(s, t) + a[i]);
}
cout << min(s, t) << '\n';
}
t33f