結果

問題 No.674 n連勤
ユーザー Mr.FukuMr.Fuku
提出日時 2018-08-13 18:55:04
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 780 bytes
コンパイル時間 114 ms
コンパイル使用メモリ 11,908 KB
実行使用メモリ 10,188 KB
最終ジャッジ日時 2023-10-24 16:42:59
合計ジャッジ時間 5,245 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
10,156 KB
testcase_01 AC 26 ms
10,140 KB
testcase_02 AC 26 ms
10,140 KB
testcase_03 AC 27 ms
10,140 KB
testcase_04 AC 26 ms
10,140 KB
testcase_05 AC 27 ms
10,140 KB
testcase_06 AC 26 ms
10,140 KB
testcase_07 AC 26 ms
10,140 KB
testcase_08 AC 28 ms
10,140 KB
testcase_09 AC 25 ms
10,140 KB
testcase_10 AC 26 ms
10,140 KB
testcase_11 AC 48 ms
10,156 KB
testcase_12 WA -
testcase_13 AC 247 ms
10,156 KB
testcase_14 AC 255 ms
10,156 KB
testcase_15 WA -
testcase_16 TLE -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

D,Q = map(int,input().split())
union = []
maxd = 0

for i in range(Q):
    s,t = map(int,input().split())
    index = len(union)
    for j in range(len(union)):
        if union[j][0]>s:
            index = j
            break
    t_bond,b_bond = False,False
    if index>0 and union[index-1][1]+1>=s:t_bond=True
    if index<len(union) and union[index][0]-1<=t:b_bond=True
    if t_bond and b_bond:
        union[index-1][1]=max(t,union[index][1])
        union.pop(index)
        index-=1
    elif t_bond:
        union[index-1][1]=max(t,union[index-1][1])
        index-=1
    elif b_bond:
        union[index][0]=s
        union[index][1]=max(t,union[index][1])
    else:
        union.insert(index,[s,t])
    maxd = max(maxd,union[index][1]-union[index][0]+1)
    print(maxd)
0