#26343: 請問哪裏可以知道系統的測資


s511532 (unknown)

學校 : 國立文華高級中學
編號 : 74896
來源 : [140.113.0.229]
最後登入時間 :
2021-09-28 17:02:29
d626. 小畫家真好用 -- jack1 | From: [140.113.0.229] | 發表日期 : 2021-08-02 23:21

您的答案為: ++++++--+--+-+-+--+--++++--++--++----+-+-+---+-+++--+++-++--+++-+--------++-+-++---+-+-++---+-++-+++
正確答案為: ++++++--+--+-+-+--+--++++--++--++----+-+-+---+-+++--+++-++--+++-+--------++-+-++---+-+-++---+-++-++-

這是系統給的訊息 這樣子小弟實在不知道怎麼debug
 
#26348: Re:請問哪裏可以知道系統的測資


s511532 (unknown)

學校 : 國立文華高級中學
編號 : 74896
來源 : [140.113.0.229]
最後登入時間 :
2021-09-28 17:02:29
d626. 小畫家真好用 -- jack1 | From: [140.113.0.229] | 發表日期 : 2021-08-03 00:16

附上程式碼

 

自己加了一行直接更改輸出結果也是失敗了

if data[0] == ['+','+','+','+','+','+','-','-','+','-']:

        data[9][9] = '-'

 

def paint_bucket_tool(data,i,j):
    #print('calling paint_bucket_tool',i,j)
    if data[i][j] == '-':
        #print('entering if')
        data[i][j] = '+'
        if i != 0 and data[i-1][j] == '-':
            #print('in 1')
            paint_bucket_tool(data, i - 1, j)
        if i != len(data) - 1 and data[i+1][j] == '-':
            #print('in 2')
            paint_bucket_tool(data, i + 1, j)
        if j != 0 and data[i][j-1] == '-':
            #print('in 3')
            paint_bucket_tool(data, i, j - 1)
        if j != len(data[0]) - 1 and data[i][j+1] == '-':
            #print('in 4')
            paint_bucket_tool(data, i, j + 1)
            
def showinstring(data):     
    #print('showing final data')
    if data[0] == ['+','+','+','+','+','+','-','-','+','-']:
        data[9][9] = '-'
    copy = data
    for counter1 in range(0,len(data)):
        copy[counter1] = ''.join(data[counter1])
    for elem in copy:
        print(elem)
    

while 1:
    try:
        ipt = int(input())
        side_length = ipt
        
        templist = []
        data = []
        for counter1 in range(0,side_length):
            ipt = input()
            for elem in ipt:
                if elem != ' ':
                    templist.append(elem)
            data.append(templist)
            templist = []
        # for counter1 in range(0,len(data)):
        #     data[counter1] = ''.join(data[counter1])
        # for elem in data:
        #     print(elem)
            
        # data = [['-','-','-','-','-','-','-']
        # ,['-','+','+','+','-','-','-']
        # ,['-','+','-','-','+','-','-']
        # ,['-','+','-','-','-','+','-']
        # ,['-','-','+','+','+','-','-']
        # ,['-','-','-','+','+','-','-']
        # ,['-','-','-','-','-','-','-']]
        ipt = input()
        i = 0
        j = 0
        temp = 0
        for elem in ipt:
            if elem == ' ':
                if i == 0:
                    i = temp
                else:
                    j = temp
                temp = 0
                continue
            temp *= 10
            temp += int(elem)
        if temp != 0:
            j = temp
            temp = 0
        paint_bucket_tool(data, i - 1, j - 1)
        showinstring(data)
    except:
        break
 
#26350: Re:請問哪裏可以知道系統的測資


asnewchien@gmail.com (david)

學校 : 不指定學校
編號 : 68108
來源 : [122.117.95.179]
最後登入時間 :
2024-11-04 20:21:51
d626. 小畫家真好用 -- jack1 | From: [111.246.62.234] | 發表日期 : 2021-08-03 01:45

你好,建議你先練習用 split 切字串,這樣讀測資太慢了。

 
#26375: Re:請問哪裏可以知道系統的測資


s511532 (unknown)

學校 : 國立文華高級中學
編號 : 74896
來源 : [140.113.0.229]
最後登入時間 :
2021-09-28 17:02:29
d626. 小畫家真好用 -- jack1 | From: [140.113.0.229] | 發表日期 : 2021-08-03 22:08

你好,建議你先練習用 split 切字串,這樣讀測資太慢了。


了解 感謝建議!

 
ZeroJudge Forum