結果

問題 No.833 かっこいい電車
ユーザー kamomekamome
提出日時 2019-07-02 01:12:15
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 909 bytes
コンパイル時間 86 ms
コンパイル使用メモリ 10,932 KB
実行使用メモリ 29,128 KB
最終ジャッジ日時 2023-09-14 23:26:22
合計ジャッジ時間 7,686 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 16 ms
7,800 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 16 ms
7,872 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 42 ms
12,080 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 360 ms
29,128 KB
testcase_31 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/python3
class train:
    def __init__ (self,c):
        """ Class initialiser """
        self.connected=False
        self.cool=c
    def remodel(self):
        self.cool=self.cool+1
    def connect (self):
        self.connected=True
    def disconnect (self):
        self.connected=False
N,Q=input().split()
#cool_trains=[ int(x) for x in input().split() ]
trains=[]
for t in input().split():
    trains.append(train(int(t)))

    
        
        
#print(trains)
for i in range(int(Q)):
    q,x=input().split()
    x=int(x)
    if q=="1":
        trains[x-1].connect()
    elif q=="2":
        trains[x-1].disconnect()
    elif q=="3":
        trains[x-1].remodel()
    elif q=="4":
        def chk_tr_cnct(N):
            if trains[N].connected:
                return trains[N].cool+chk_tr_cnct(N+1)
            else:
                return trains[N].cool 
        print(chk_tr_cnct(x-1))

0