結果

問題 No.3066 Collecting Coins Speedrun 1
ユーザー Andrew8128
提出日時 2025-03-21 21:32:08
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 44 ms / 2,000 ms
コード長 439 bytes
コンパイル時間 903 ms
コンパイル使用メモリ 99,464 KB
実行使用メモリ 7,324 KB
最終ジャッジ日時 2025-03-21 21:32:11
合計ジャッジ時間 2,388 ms
ジャッジサーバーID
(参考情報)
judge7 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
int main()
{
  int N;
  cin >> N;
  vector<ll> c(N);
  for (int i = 0; i < N; i++)
  {
    cin >> c[i];
  }
  ll ans = 0;
  if (c[0] < 0)
  {
    ans += abs(c[0]) * 2;
  }
  if (0 < c[N-1])
  {
    ans += abs(c[N-1]) * 2;
  }
  cout << ans << '\n';
  return 0;
}
/*
  File : ~/yukicoder/530/C.cpp
  Date : 2025/03/21
  Time : 21:28:43
*/
0