結果

問題 No.1869 Doubling?
ユーザー cpcznksutbeoacpcznksutbeoa
提出日時 2021-11-23 02:57:34
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 769 bytes
コンパイル時間 1,492 ms
コンパイル使用メモリ 163,364 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-27 00:10:09
合計ジャッジ時間 4,340 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,384 KB
testcase_03 AC 1 ms
4,384 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,384 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 WA -
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 1 ms
4,384 KB
testcase_18 AC 2 ms
4,384 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 2 ms
4,384 KB
testcase_34 AC 2 ms
4,380 KB
testcase_35 AC 2 ms
4,384 KB
testcase_36 AC 1 ms
4,384 KB
testcase_37 AC 1 ms
4,380 KB
testcase_38 AC 1 ms
4,380 KB
testcase_39 AC 2 ms
4,384 KB
testcase_40 AC 1 ms
4,380 KB
testcase_41 AC 2 ms
4,384 KB
testcase_42 WA -
testcase_43 WA -
testcase_44 AC 1 ms
4,380 KB
testcase_45 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main() {
    int mod = 998244853;
    long long N, X; cin >> N >> X;
    long long n = 1;
    bool higher = false;
    for (int i = 1; i < N; i++) {
        n *= 2;
        if (n > X) {
            higher = true;
            break;
        }
    }
    long long answer = 0;
    if (higher)
        for (int i = 0; i < N; i++) {
            if (X == 1) {
                answer += N - i;
                answer %= mod;
                break;
            }
            answer += X;
            answer %= mod;
            X = (X % 2 == 0 ? X / 2 : (X + 1) / 2);
        }
    else
        for (int i = 0; i < N; i++) {
            answer = answer * 2 + 1;
            answer %= mod;
        }
    cout << answer << endl;
}
0