結果
| 問題 | No.3066 Collecting Coins Speedrun 1 |
| コンテスト | |
| ユーザー |
forest3
|
| 提出日時 | 2025-03-23 17:05:35 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 24 ms / 2,000 ms |
| コード長 | 350 bytes |
| 記録 | |
| コンパイル時間 | 829 ms |
| コンパイル使用メモリ | 183,856 KB |
| 実行使用メモリ | 9,228 KB |
| 最終ジャッジ日時 | 2026-07-07 20:47:32 |
| 合計ジャッジ時間 | 2,694 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 32 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < n; i++)
int main() {
int N;
cin >> N;
vector<int> c(N);
rep(i, N) cin >> c[i];
int ans = 1e9;
if(c[0] >= 0) ans = c[N - 1] * 2;
else if(c[N - 1] <= 0) ans = abs(c[0]) * 2;
else ans = (abs(c[0]) + c[N - 1]) * 2;
cout << ans << endl;
}
forest3