結果
問題 | No.488 四角関係 |
ユーザー |
|
提出日時 | 2017-04-09 19:50:20 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 926 ms / 5,000 ms |
コード長 | 911 bytes |
コンパイル時間 | 177 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 79,060 KB |
最終ジャッジ日時 | 2024-07-18 01:37:16 |
合計ジャッジ時間 | 7,371 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
N, M = map( int, input().split() ) adj = [ [ 0 for i in range( N ) ] for j in range( N ) ] for i in range( M ): u, v = map( int, input().split() ) adj[ u ][ v ] = 1 adj[ v ][ u ] = 1 bag = set() for i in range( N ): for j in range( N ): for k in range( N ): for l in range( N ): qq = set() qq.add( i ) qq.add( j ) qq.add( k ) qq.add( l ) if len( qq ) != 4: continue if adj[ i ][ j ] and adj[ j ][ k ] and adj[ i ][ k ]: continue if adj[ j ][ k ] and adj[ k ][ l ] and adj[ l ][ j ]: continue if adj[ i ][ k ] and adj[ k ][ l ] and adj[ l ][ i ]: continue if adj[ i ][ j ] and adj[ j ][ l ] and adj[ l ][ i ]: continue if adj[ i ][ j ] and adj[ j ][ k ] and adj[ k ][ l ] and adj[ l ][ i ]: f = sorted( [ i, j, k, l ] ) bag.add( ( f[ 0 ], f[ 1 ], f[ 2 ], f[ 3 ] ) ) print( len( bag ) )