結果
問題 |
No.3066 Collecting Coins Speedrun 1
|
ユーザー |
![]() |
提出日時 | 2025-03-22 01:56:35 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 14 ms / 2,000 ms |
コード長 | 478 bytes |
コンパイル時間 | 3,878 ms |
コンパイル使用メモリ | 275,740 KB |
実行使用メモリ | 5,888 KB |
最終ジャッジ日時 | 2025-03-22 01:56:41 |
合計ジャッジ時間 | 5,549 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 32 |
ソースコード
#include<bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0;i<(int)(n);i++) #define ALL(v) v.begin(),v.end() typedef long long ll; template <class T> using V=vector<T>; template <class T> using VV=V<V<T>>; int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); ll n; cin>>n; V<ll> C(n); rep(i,n) cin>>C[i]; if(C[0]>=0) cout<<2*C[n-1]<<endl; else if(C[n-1]<=0) cout<<-2*C[0]<<endl; else cout<<2*(C[n-1]-C[0])<<endl; return 0; }