結果
問題 |
No.408 五輪ピック
|
ユーザー |
![]() |
提出日時 | 2016-08-12 20:03:25 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 25 ms / 5,000 ms |
コード長 | 1,005 bytes |
コンパイル時間 | 1,934 ms |
コンパイル使用メモリ | 161,412 KB |
実行使用メモリ | 7,552 KB |
最終ジャッジ日時 | 2024-11-07 12:14:18 |
合計ジャッジ時間 | 3,034 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 32 |
コンパイルメッセージ
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]); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#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; }