結果
| 問題 | No.3066 Collecting Coins Speedrun 1 |
| コンテスト | |
| ユーザー |
MM
|
| 提出日時 | 2025-03-21 21:29:48 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 25 ms / 2,000 ms |
| コード長 | 676 bytes |
| 記録 | |
| コンパイル時間 | 2,806 ms |
| コンパイル使用メモリ | 275,408 KB |
| 実行使用メモリ | 9,272 KB |
| 最終ジャッジ日時 | 2026-07-07 14:18:16 |
| 合計ジャッジ時間 | 4,523 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 32 |
ソースコード
#include"bits/stdc++.h"
#include"atcoder/all"
#define chmin(x,y) (x) = min((x),(y))
#define chmax(x,y) (x) = max((x),(y))
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define vec vector
#define all(a) a.begin(), a.end()
#define pb push_back
using namespace std;
using namespace atcoder;
using ll = long long;
using ld = long double;
const ll mod = 998244353;
using mint = modint998244353;
using Graph = vector<vector<pair<int,ll>>>;
const vector<int> dx = {1,0,-1,0}, dy = {0,1,0,-1};
int main(){
// input
int N;
cin >> N;
ll L = 0, R = 0;
rep(i,N){
ll x;
cin >> x;
if(x < 0) chmin(L,x);
else if(x > 0) chmax(R,x);
}
cout << 2 * (R - L) << endl;
}
MM