結果
| 問題 |
No.3066 Collecting Coins Speedrun 1
|
| コンテスト | |
| ユーザー |
tominn
|
| 提出日時 | 2025-04-01 23:37:20 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 45 ms / 2,000 ms |
| コード長 | 337 bytes |
| コンパイル時間 | 3,350 ms |
| コンパイル使用メモリ | 275,040 KB |
| 実行使用メモリ | 7,328 KB |
| 最終ジャッジ日時 | 2025-04-01 23:37:26 |
| 合計ジャッジ時間 | 5,255 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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