結果

問題 No.3039 配信者
ユーザー rururun
提出日時 2025-03-06 18:52:03
言語 Swift
(6.0.3)
結果
AC  
実行時間 1,514 ms / 2,000 ms
コード長 375 bytes
コンパイル時間 5,179 ms
コンパイル使用メモリ 132,928 KB
実行使用メモリ 16,916 KB
最終ジャッジ日時 2025-03-06 18:52:25
合計ジャッジ時間 18,004 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 15
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.swift:4:5: warning: immutable value 'i' was never used; consider replacing with '_' or removing it
 2 | let (n,h) = (nk[0],nk[1])
 3 | var arr = [Int](repeating: 0, count: h+1)
 4 | for i in 1...n{
   |     `- warning: immutable value 'i' was never used; consider replacing with '_' or removing it
 5 |     let ab = readLine()!.split(separator: " ").map{Int($0)!}
 6 |     let (a,b) = (ab[0],ab[1])

ソースコード

diff #

let nk = readLine()!.split(separator: " ").map{Int($0)!}
let (n,h) = (nk[0],nk[1])
var arr = [Int](repeating: 0, count: h+1)
for i in 1...n{
    let ab = readLine()!.split(separator: " ").map{Int($0)!}
    let (a,b) = (ab[0],ab[1])
    arr[a] += 1
    arr[b+1] -= 1
}
for i in 0..<h{
    arr[i+1] += arr[i]
}
var Max = 0
for i in 0..<h{
    Max = max(Max,arr[i])
}
print(Max)
0