結果
問題 |
No.3066 Collecting Coins Speedrun 1
|
ユーザー |
|
提出日時 | 2025-03-23 11:05:39 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 13 ms / 2,000 ms |
コード長 | 361 bytes |
コンパイル時間 | 2,286 ms |
コンパイル使用メモリ | 192,204 KB |
実行使用メモリ | 7,328 KB |
最終ジャッジ日時 | 2025-03-23 11:05:43 |
合計ジャッジ時間 | 3,875 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 32 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { cin.tie(nullptr); ios_base::sync_with_stdio(false); int n; cin >> n; int l = 0, r = 0; for (int i = 0; i < n; i++) { int c; cin >> c; if (c >= 0) r = max(r, c); else l = min(l, c); } cout << 2 * (r - l) << "\n"; return 0; }