結果

問題 No.462 6日知らずのコンピュータ
コンテスト
ユーザー zuojiarui1027
提出日時 2026-07-24 22:46:16
言語 C++23(gcc16)
(gcc 16.1.0 + boost 1.90.0)
コンパイル:
g++-16 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 743 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,282 ms
コンパイル使用メモリ 349,696 KB
実行使用メモリ 5,888 KB
最終ジャッジ日時 2026-07-24 22:46:29
合計ジャッジ時間 5,380 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 50 WA * 34
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
#define int long long
using namespace std;
int p = 1e9 + 7;
int ji[100];
int f(int x)
{
    if (x < 0)
    {
        cout << 0;
        exit(0);
    }
    int ans = 0;
    while (x)
    {
        if (x % 2 == 1)
            ans++;
        x /= 2;
    }
    return ji[ans];
}
signed main()
{
   
    ji[0] = 1;
    for (int i = 1; i <= 62; i++)
    {
        ji[i] = ji[i - 1] * i % p;
        ji[i] = ji[i] % p;
    }
    int n, t;
    cin >> n >> t;
    int ans = 1;
    int hh;
    int s = 0;
    for (int i = 1; i <= t; i++)
    {
        cin >> hh;
        ans = ans * f(hh - s);
        ans = ans % p;
        s = hh;
    }
    ans = ans * f(pow(2, n) - 1 - s);
    ans = ans % p;
    cout << ans;
    return 0;
}
0