結果
| 問題 | No.3066 Collecting Coins Speedrun 1 |
| コンテスト | |
| ユーザー |
tominn
|
| 提出日時 | 2025-04-01 23:37:20 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 25 ms / 2,000 ms |
| コード長 | 337 bytes |
| 記録 | |
| コンパイル時間 | 2,007 ms |
| コンパイル使用メモリ | 331,032 KB |
| 実行使用メモリ | 9,228 KB |
| 最終ジャッジ日時 | 2026-07-08 07:36:41 |
| 合計ジャッジ時間 | 3,901 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 32 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> c(n);
for (int i = 0; i < n; i++) cin >> c[i];
int l = c[0], r = c[n - 1];
int ans;
if (0 <= l) ans = r * 2;
else if (r <= 0) ans = abs(l) * 2;
else ans = abs(l - r) * 2;
cout << ans << endl;
return 0;
}
tominn