結果
| 問題 | No.674 n連勤 |
| コンテスト | |
| ユーザー |
Mr.Fuku
|
| 提出日時 | 2018-08-13 18:55:04 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 780 bytes |
| 記録 | |
| コンパイル時間 | 218 ms |
| コンパイル使用メモリ | 12,928 KB |
| 実行使用メモリ | 19,108 KB |
| 最終ジャッジ日時 | 2024-09-24 08:06:04 |
| 合計ジャッジ時間 | 5,385 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 11 WA * 2 TLE * 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)
Mr.Fuku