結果

問題 No.2486 Don't come next to me
ユーザー 259-Momone259-Momone
提出日時 2023-09-29 22:17:42
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 119 ms / 2,000 ms
コード長 509 bytes
コンパイル時間 3,209 ms
コンパイル使用メモリ 221,376 KB
実行使用メモリ 4,616 KB
最終ジャッジ日時 2023-09-29 22:17:48
合計ジャッジ時間 5,241 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 102 ms
4,592 KB
testcase_01 AC 92 ms
4,376 KB
testcase_02 AC 28 ms
4,376 KB
testcase_03 AC 66 ms
4,376 KB
testcase_04 AC 89 ms
4,376 KB
testcase_05 AC 66 ms
4,376 KB
testcase_06 AC 74 ms
4,376 KB
testcase_07 AC 14 ms
4,376 KB
testcase_08 AC 29 ms
4,376 KB
testcase_09 AC 90 ms
4,392 KB
testcase_10 AC 68 ms
4,376 KB
testcase_11 AC 40 ms
4,380 KB
testcase_12 AC 20 ms
4,380 KB
testcase_13 AC 119 ms
4,616 KB
testcase_14 AC 33 ms
4,380 KB
testcase_15 AC 67 ms
4,376 KB
testcase_16 AC 15 ms
4,376 KB
testcase_17 AC 28 ms
4,376 KB
testcase_18 AC 26 ms
4,376 KB
testcase_19 AC 30 ms
4,380 KB
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/extc++.h>

int main() {
    using namespace std;
    unsigned long N, M;
    cin >> N >> M;
    vector<unsigned long> A(M);
    adjacent_difference(istream_iterator<unsigned long>{cin}, istream_iterator<unsigned long>{}, begin(A));
    A.erase(begin(A));
    
    unsigned long ans{};
    for(auto a : A){
        --a;
        unsigned long x{};
        while(a > 1 && a & 1){
            a /= 2;
            ++x;
        }
        ans += a << x;
    }
    cout << ans << endl;
    return 0;
}
0