結果
問題 |
No.378 名声値を稼ごう
|
ユーザー |
![]() |
提出日時 | 2024-08-14 00:22:30 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 567 bytes |
コンパイル時間 | 2,773 ms |
コンパイル使用メモリ | 246,848 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-08-14 00:22:34 |
合計ジャッジ時間 | 3,584 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 4 WA * 1 |
ソースコード
#include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #else #define Debug(...) void(0) #endif #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; int main() { ll n; cin >> n; vector<ll> a(0); while (n) { a.push_back(n); n >>= 1; } ll sum = accumulate(a.begin(), a.end(), 0LL); ll sum2 = sum; ll ans = 0; while (a.size() > 1) { sum2 -= a.back(); a.pop_back(); ans = max(ans, sum2 + a.back() - sum); } cout << ans << endl; return 0; }