結果

問題 No.1400 すごろくで世界旅行
ユーザー CuriousFairy315CuriousFairy315
提出日時 2019-12-31 17:47:17
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 807 bytes
コンパイル時間 729 ms
コンパイル使用メモリ 70,132 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-05-06 09:59:57
合計ジャッジ時間 2,671 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 WA -
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 3 ms
5,376 KB
testcase_04 WA -
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 3 ms
5,376 KB
testcase_07 AC 4 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 3 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 11 ms
5,376 KB
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 AC 2 ms
5,376 KB
testcase_20 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<bitset>
using namespace std;

int main() {
    int V, D;
    cin >> V >> D;
    bitset<1000> G[1000];
    string E;
    for (int i = 0;i < V;++ i) {
        cin >> E;
        G[i] = bitset<1000>(E);
    }
    
    bool ans = G[0].any();
    for (int i = 0;i < V;++ i) {
        bitset<1000> now, one, two, three, tmp;
        now = G[i];
        one[i] = true;
        for (int j = 1;j < D;++ j) {
            tmp = now ^ two;
            if (tmp.none()) break;
            three |= one;
            for (int k = 0;k < V;++ k) if (tmp[k]) three |= G[k];
            tmp = three;
            three = two;
            two = one;
            one = now;
            now = tmp;
        }
        ans &= now.count() == V;
    }
    cout << (ans ? "Yes" : ":(") << endl;
    return 0;
}
0