結果

問題 No.408 五輪ピック
ユーザー finefine
提出日時 2016-08-05 23:41:16
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 771 bytes
コンパイル時間 1,840 ms
コンパイル使用メモリ 162,556 KB
実行使用メモリ 352,128 KB
最終ジャッジ日時 2024-04-24 19:41:44
合計ジャッジ時間 17,258 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
5,248 KB
testcase_02 AC 2 ms
5,248 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 MLE -
testcase_07 MLE -
testcase_08 WA -
testcase_09 MLE -
testcase_10 MLE -
testcase_11 MLE -
testcase_12 MLE -
testcase_13 WA -
testcase_14 AC 169 ms
56,448 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 MLE -
testcase_18 MLE -
testcase_19 MLE -
testcase_20 MLE -
testcase_21 AC 190 ms
52,096 KB
testcase_22 MLE -
testcase_23 MLE -
testcase_24 MLE -
testcase_25 WA -
testcase_26 MLE -
testcase_27 AC 14 ms
6,656 KB
testcase_28 MLE -
testcase_29 MLE -
testcase_30 AC 2 ms
5,376 KB
testcase_31 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int A[20000][20000];
int x[20000];
int ret[20000];

void mul(int A[20000][20000], int* x, int n) {
    for (int i = 0; i < n; i++) {
        ret[i] = 0;
        for (int j = 0; j < n; j++) {
            ret[i] += A[i][j] * x[j];
        }
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        A[a][b] = 1;
        A[b][a] = 1;
    }
    for (int i = 0; i < n; i++) x[i] = A[0][i];
    for (int i = 0; i < 4; i++) {
        mul(A, x, n);
        memcpy(ret, x, sizeof(int) * 20000);
    }
    if (x[0] == 0) cout << "NO\n";
    else cout << "YES\n";
    return 0;
}
0