結果
問題 |
No.674 n連勤
|
ユーザー |
![]() |
提出日時 | 2018-08-13 18:54:28 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 797 bytes |
コンパイル時間 | 145 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 17,820 KB |
最終ジャッジ日時 | 2024-09-24 08:05:53 |
合計ジャッジ時間 | 6,709 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | WA * 13 OLE * 1 -- * 3 |
ソースコード
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) print(union)