結果
問題 | No.3066 Collecting Coins Speedrun 1 |
ユーザー |
![]() |
提出日時 | 2025-03-21 21:33:33 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 13 ms / 2,000 ms |
コード長 | 527 bytes |
コンパイル時間 | 3,265 ms |
コンパイル使用メモリ | 275,676 KB |
実行使用メモリ | 7,324 KB |
最終ジャッジ日時 | 2025-03-21 21:33:39 |
合計ジャッジ時間 | 4,278 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge7 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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 ll long long #define INF 9e18; int main(){ cin.tie(0)->sync_with_stdio(0); cout.tie(0); int N; cin>>N; vector<ll>c(N); rep(i,N) cin>>c.at(i); ll start=c.at(0); ll end=c.at(N-1); ll ans=0; if(start<0 && end<0){ ans=abs(start*2); } else if(start>=0 && end>=0){ ans=abs(end*2); } else{ ans=abs(start*2)+abs(end*2); } cout<<ans<<endl; }