結果
| 問題 |
No.640 76本のトロンボーン
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-03-06 09:50:12 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,630 bytes |
| コンパイル時間 | 103 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-09-15 08:21:24 |
| 合計ジャッジ時間 | 1,444 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge6 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 3 WA * 12 |
ソースコード
################################
## Definition of functions
## 関数定義
################################
def ReAdjustTo2DArray( warehouse, size ):
List = []
tempList = []
num = 0
for element in warehouse:
if element != "\n":
if num != (size-1):
tempList.append( element )
num += 1
else:
tempList.append( element )
List.append( tempList )
tempList = []
num = 0
return List
def MakeSet( List, Size ):
_set = []
for row in range( Size ):
for column in range( Size ):
if List[row][column] == ".":
## Check right side
rowtempList = []
rowtempList.append( (row+1)*10+(column+1) )
for i in range( 1, Size-1 ):
if (row+i) <= (Size-1):
if List[row+i][column] == ".":
rowtempList.append( (row+i+1)*10 + (column+1) )
if len(rowtempList) == (Size-1):
_set.append( sorted(rowtempList) )
## Check down side
coltempList = []
coltempList.append( (row+1)*10+(column+1) )
for i in range( 1, Size-1 ):
if (column+i) <= (Size-1):
if List[row][column+i] == ".":
coltempList.append( (row+1)*10+(column+i+1) )
if len(coltempList) == (Size-1):
_set.append( sorted(coltempList) )
return sorted(_set)
def FindSol( _set, goods_position = [] ):
if len( _set ) > 0:
goods_position.append( _set[0] )
compareEl = set(_set[0])
_set.remove( _set[0] )
RemoveSet = []
for element in _set:
if( len( compareEl.intersection( set(element) ) ) > 0 ):
RemoveSet.append( element )
for element in RemoveSet:
_set.remove( element )
FindSol( _set, goods_position )
return sorted(goods_position)
################################
## Quizs
## クイズ
################################
# warehouse = '''
# #..
# ...
# ..#
# '''
warehouse = '''
#.#.#
.....
#.#.#
#.#.#
.....
'''
################################
## Execution
## 実行
################################
## NxN warehouse's size is N
## 倉庫サイズは N
################################
Size = 5
## Make matrices of warehouse
## 倉庫を配列化
################################
warehouse_1D = list( warehouse )
warehouse_2D = ReAdjustTo2DArray( warehouse_1D, Size )
## Find all possible solutions
## おける場所全部探す
################################
PossiblePosition = MakeSet( warehouse_2D, Size )
## Find the solutions without overlapping
## 重複しない答えを選択
################################
Solution = len( FindSol( PossiblePosition ) )
print( Solution )