結果

問題 No.408 五輪ピック
ユーザー treeonetreeone
提出日時 2016-08-12 19:19:04
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 22 ms / 5,000 ms
コード長 1,169 bytes
コンパイル時間 1,539 ms
コンパイル使用メモリ 161,800 KB
実行使用メモリ 7,424 KB
最終ジャッジ日時 2024-04-25 02:37:29
合計ジャッジ時間 2,555 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 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 12 ms
6,400 KB
testcase_06 AC 8 ms
5,504 KB
testcase_07 AC 12 ms
6,144 KB
testcase_08 AC 10 ms
5,888 KB
testcase_09 AC 10 ms
5,760 KB
testcase_10 AC 9 ms
5,504 KB
testcase_11 AC 8 ms
5,504 KB
testcase_12 AC 14 ms
6,144 KB
testcase_13 AC 11 ms
6,528 KB
testcase_14 AC 4 ms
5,376 KB
testcase_15 AC 11 ms
6,784 KB
testcase_16 AC 12 ms
6,400 KB
testcase_17 AC 14 ms
6,528 KB
testcase_18 AC 14 ms
6,528 KB
testcase_19 AC 16 ms
6,784 KB
testcase_20 AC 4 ms
5,376 KB
testcase_21 AC 4 ms
5,376 KB
testcase_22 AC 8 ms
5,504 KB
testcase_23 AC 22 ms
7,424 KB
testcase_24 AC 15 ms
6,528 KB
testcase_25 AC 13 ms
7,296 KB
testcase_26 AC 17 ms
6,528 KB
testcase_27 AC 16 ms
6,912 KB
testcase_28 AC 13 ms
6,016 KB
testcase_29 AC 22 ms
5,888 KB
testcase_30 AC 2 ms
5,376 KB
testcase_31 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:16:17: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘long long int*’ [-Wformat=]
   16 |         scanf("%d %d", &a[i], &b[i]);
      |                ~^      ~~~~~
      |                 |      |
      |                 int*   long long int*
      |                %lld
main.cpp:16:20: warning: format ‘%d’ expects argument of type ‘int*’, but argument 3 has type ‘long long int*’ [-Wformat=]
   16 |         scanf("%d %d", &a[i], &b[i]);
      |                   ~^          ~~~~~
      |                    |          |
      |                    int*       long long int*
      |                   %lld
main.cpp:16:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   16 |         scanf("%d %d", &a[i], &b[i]);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
//#define FOR(i, a) for(auto& i : a)
#define all(a) a.begin(), a.end()
#define int long long
using namespace std;

int n, m;
int a[50010], b[50010];
vector<int> e[20010], p[20010];

signed main(){
    cin >> n >> m;
    rep(i, 0, m){
        scanf("%d %d", &a[i], &b[i]);
        a[i]--;
        b[i]--;
        e[a[i]]. push_back(b[i]);
        e[b[i]]. push_back(a[i]);
    }
    //FOR(i, e[0]) FOR(j, e[i])
    rep(i, 0, e[0].size()){
        int t = e[0][i];
        rep(j, 0, e[t].size()){
            p[e[t][j]]. push_back(t);
        }
    }

    rep(i, 0, m){
        if(a[i] == 0 || b[i] == 0) continue;
        if(p[a[i]].size() > 3 && p[b[i]].size() > 3){
            cout << "YES" << endl;
            return 0;
        }
        rep(j, 0, p[a[i]].size()){
            rep(k, 0, p[b[i]].size()){
                if(p[a[i]][j] != p[b[i]][k] && p[a[i]][j] != b[i] && p[b[i]][k] != a[i]){
                    cout << "YES" << endl;
                    return 0;
                }
            }
        }
    }
    cout << "NO" << endl;
}
0