結果
問題 |
No.408 五輪ピック
|
ユーザー |
![]() |
提出日時 | 2016-08-05 23:44:22 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
MLE
|
実行時間 | - |
コード長 | 851 bytes |
コンパイル時間 | 179 ms |
コンパイル使用メモリ | 23,168 KB |
実行使用メモリ | 451,256 KB |
最終ジャッジ日時 | 2024-11-07 04:35:08 |
合計ジャッジ時間 | 20,582 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 7 MLE * 18 -- * 7 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:6:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 6 | scanf("%d%d", &n, &m); | ~~~~~^~~~~~~~~~~~~~~~ main.cpp:8:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 8 | scanf("%d%d", &a[i], &b[i]); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> int n, m, a[50000], b[50000], c[20000][20000]; int main() { scanf("%d%d", &n, &m); for(int i = 0; i < m; i++) { scanf("%d%d", &a[i], &b[i]); a[i]--; b[i]--; c[ a[i] ][ b[i] ] = 1; c[ b[i] ][ a[i] ] = 1; } bool flag = false; for(int i = 0; i < m; i++) { for(int j = 0; j < m; j++) { if( a[i] == 0 || b[i] == 0 || a[j] == 0 || b[j] == 0 || a[i] == a[j] || a[i] == b[j] || b[i] == a[j] || b[i] == b[j] ) { continue; } if( (c[0][ a[i] ] == 1 && c[0][ a[j] ] == 1 && c[ b[i] ][ b[j] ] == 1) || (c[0][ a[i] ] == 1 && c[0][ b[j] ] == 1 && c[ b[i] ][ a[j] ] == 1) || (c[0][ b[i] ] == 1 && c[0][ a[j] ] == 1 && c[ a[i] ][ b[j] ] == 1) || (c[0][ b[i] ] == 1 && c[0][ b[j] ] == 1 && c[ a[i] ][ a[j] ] == 1) ) { flag = true; i = j = m; } } } printf("%s\n", flag ? "YES" : "NO"); return 0; }