結果

問題 No.408 五輪ピック
ユーザー srup٩(๑`н´๑)۶srup٩(๑`н´๑)۶
提出日時 2016-08-07 06:11:21
言語 C++11
(gcc 11.4.0)
結果
MLE  
実行時間 -
コード長 1,120 bytes
コンパイル時間 552 ms
コンパイル使用メモリ 63,104 KB
実行使用メモリ 252,544 KB
最終ジャッジ日時 2024-04-24 19:46:32
合計ジャッジ時間 3,998 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,248 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 17 ms
9,216 KB
testcase_06 MLE -
testcase_07 MLE -
testcase_08 AC 26 ms
20,736 KB
testcase_09 AC 52 ms
54,144 KB
testcase_10 MLE -
testcase_11 MLE -
testcase_12 MLE -
testcase_13 AC 20 ms
11,648 KB
testcase_14 WA -
testcase_15 AC 14 ms
7,424 KB
testcase_16 AC 28 ms
16,896 KB
testcase_17 AC 48 ms
41,216 KB
testcase_18 MLE -
testcase_19 MLE -
testcase_20 MLE -
testcase_21 WA -
testcase_22 MLE -
testcase_23 MLE -
testcase_24 MLE -
testcase_25 AC 15 ms
8,192 KB
testcase_26 MLE -
testcase_27 WA -
testcase_28 MLE -
testcase_29 MLE -
testcase_30 WA -
testcase_31 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:16:24: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   16 |         int a, b; scanf("%d %d", &a, &b);
      |                   ~~~~~^~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)

int n, m;
vector<int> g[20001];
vector<int> h[20001];
bool memo[20001][20001];

int main(void){
    cin >> n >> m;
    rep(i, m){
        int a, b; scanf("%d %d", &a, &b);
        a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
        memo[a][b] = memo[b][a] = true;
        
    }

    //1 - u - vとなるような辺を見つける
    for(int u : g[0]){
        for (int v : g[u]){
            //頂点に戻るようなものは入れない
            if(v != 0) h[u].push_back(v);
        }
    }

    for (int i = 1; i < n; ++i){
        for (int j = i + 1; j < n; ++j){
            if(h[i].size() > 3 && h[j].size() > 3){
                printf("YES\n"); return 0;
            }
            for (int p : h[i]){
                for (int q : h[j]){
                    if(p != j && p != q && i != q){
                        printf("YES\n"); return 0;
                    }
                }
            }
        }
    }
    printf("NO\n");
    return 0;
}
0