結果

問題 No.2071 Shift and OR
ユーザー 遭難者遭難者
提出日時 2022-09-12 02:57:06
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 20 ms / 2,000 ms
コード長 789 bytes
コンパイル時間 931 ms
コンパイル使用メモリ 28,460 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-08-19 07:49:51
合計ジャッジ時間 3,079 ms
ジャッジサーバーID
(参考情報)
judge13 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
4,380 KB
testcase_01 AC 6 ms
4,380 KB
testcase_02 AC 9 ms
4,380 KB
testcase_03 AC 17 ms
4,384 KB
testcase_04 AC 13 ms
4,384 KB
testcase_05 AC 19 ms
4,384 KB
testcase_06 AC 15 ms
4,384 KB
testcase_07 AC 11 ms
4,384 KB
testcase_08 AC 12 ms
4,380 KB
testcase_09 AC 13 ms
4,384 KB
testcase_10 AC 14 ms
4,384 KB
testcase_11 AC 18 ms
4,380 KB
testcase_12 AC 20 ms
4,384 KB
testcase_13 AC 18 ms
4,504 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 19 ms
4,384 KB
testcase_16 AC 18 ms
4,380 KB
testcase_17 AC 18 ms
4,380 KB
testcase_18 AC 6 ms
4,384 KB
testcase_19 AC 18 ms
4,380 KB
testcase_20 AC 18 ms
4,380 KB
testcase_21 AC 19 ms
4,384 KB
testcase_22 AC 18 ms
4,384 KB
testcase_23 AC 5 ms
4,380 KB
testcase_24 AC 6 ms
4,380 KB
testcase_25 AC 5 ms
4,380 KB
testcase_26 AC 5 ms
4,380 KB
testcase_27 AC 6 ms
4,384 KB
testcase_28 AC 6 ms
4,384 KB
testcase_29 AC 5 ms
4,380 KB
testcase_30 AC 14 ms
4,380 KB
testcase_31 AC 12 ms
4,380 KB
testcase_32 AC 12 ms
4,380 KB
testcase_33 AC 13 ms
4,384 KB
testcase_34 AC 14 ms
4,388 KB
testcase_35 AC 14 ms
4,384 KB
testcase_36 AC 14 ms
4,384 KB
testcase_37 AC 13 ms
4,380 KB
testcase_38 AC 13 ms
4,380 KB
testcase_39 AC 13 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <stdbool.h>
#define inf 65536
bool t[inf], tt[inf];
int main()
{
    int n;
    scanf("%d", &n);
    t[0] = true;
    for (int ii = 0; ii < n; ii++)
    {
        int x;
        scanf("%d", &x);
        for (int i = 0; i < inf; i++)
            tt[i] = t[i];
        for (int loop = 0; loop < 16; loop++, x = (x >> 1) | ((x & 1) << 15))
            for (int i = 0; i < inf; i++)
                if (t[i])
                    tt[i | x] = true;
        for (int i = 0; i < inf; i++)
            t[i] = tt[i];
        if (t[inf - 1])
        {
            printf("%d\n", inf - 1);
            return 0;
        }
    }
    for (int i = inf - 1;; i--)
    {
        if (!t[i])
            continue;
        printf("%d\n", i);
        return 0;
    }
    return 0;
}
0