結果

問題 No.408 五輪ピック
ユーザー treeonetreeone
提出日時 2016-08-12 20:03:25
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 27 ms / 5,000 ms
コード長 1,005 bytes
コンパイル時間 1,624 ms
コンパイル使用メモリ 161,392 KB
実行使用メモリ 7,552 KB
最終ジャッジ日時 2024-04-25 02:39:02
合計ジャッジ時間 3,198 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 3 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 3 ms
5,376 KB
testcase_04 AC 3 ms
5,376 KB
testcase_05 AC 14 ms
6,528 KB
testcase_06 AC 11 ms
5,632 KB
testcase_07 AC 16 ms
6,144 KB
testcase_08 AC 12 ms
6,016 KB
testcase_09 AC 13 ms
5,888 KB
testcase_10 AC 11 ms
5,632 KB
testcase_11 AC 10 ms
5,504 KB
testcase_12 AC 18 ms
6,400 KB
testcase_13 AC 14 ms
6,528 KB
testcase_14 AC 5 ms
5,376 KB
testcase_15 AC 14 ms
6,656 KB
testcase_16 AC 15 ms
6,528 KB
testcase_17 AC 17 ms
6,656 KB
testcase_18 AC 17 ms
6,528 KB
testcase_19 AC 20 ms
6,784 KB
testcase_20 AC 6 ms
5,376 KB
testcase_21 AC 5 ms
5,376 KB
testcase_22 AC 9 ms
5,632 KB
testcase_23 AC 27 ms
7,552 KB
testcase_24 AC 19 ms
6,400 KB
testcase_25 AC 16 ms
7,168 KB
testcase_26 AC 22 ms
6,656 KB
testcase_27 AC 20 ms
7,040 KB
testcase_28 AC 16 ms
6,016 KB
testcase_29 AC 26 ms
5,888 KB
testcase_30 AC 2 ms
5,376 KB
testcase_31 AC 3 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]){
        p[j]. push_back(i);
    }

    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;
        }
        FOR(j, p[a[i]]){
            FOR(k, p[b[i]]){
                if(j != k && j != b[i] && k != a[i]){
                    cout << "YES" << endl;
                    return 0;
                }
            }
        }
    }
    cout << "NO" << endl;
}
0