結果

問題 No.29 パワーアップ
ユーザー バカらっくバカらっく
提出日時 2018-03-01 14:08:18
言語 Swift
(5.8.1)
結果
AC  
実行時間 4 ms / 5,000 ms
コード長 381 bytes
コンパイル時間 1,849 ms
コンパイル使用メモリ 131,368 KB
実行使用メモリ 8,376 KB
最終ジャッジ日時 2023-08-20 10:21:13
合計ジャッジ時間 3,078 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
8,216 KB
testcase_01 AC 4 ms
8,284 KB
testcase_02 AC 3 ms
8,216 KB
testcase_03 AC 3 ms
8,296 KB
testcase_04 AC 4 ms
8,204 KB
testcase_05 AC 4 ms
8,244 KB
testcase_06 AC 3 ms
8,340 KB
testcase_07 AC 3 ms
8,268 KB
testcase_08 AC 3 ms
8,248 KB
testcase_09 AC 3 ms
8,200 KB
testcase_10 AC 4 ms
8,160 KB
testcase_11 AC 3 ms
8,244 KB
testcase_12 AC 4 ms
8,192 KB
testcase_13 AC 4 ms
8,312 KB
testcase_14 AC 4 ms
8,376 KB
testcase_15 AC 4 ms
8,296 KB
testcase_16 AC 3 ms
8,164 KB
testcase_17 AC 4 ms
8,192 KB
testcase_18 AC 3 ms
8,264 KB
testcase_19 AC 4 ms
8,248 KB
testcase_20 AC 4 ms
8,220 KB
testcase_21 AC 3 ms
8,268 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.swift:5:5: warning: immutable value 'i' was never used; consider replacing with '_' or removing it
for i in 1...inputCount {
    ^
    _

ソースコード

diff #

let inputCount = Int(readLine()!)!

var cnt = [Int:Int]()
var ans = 0
for i in 1...inputCount {
    let inpt = readLine()!.split(separator: " ").map{Int($0)!}
    for j in 0...inpt.count-1
    {
        if(cnt[inpt[j]]==nil) {
            cnt[inpt[j]] = 1
        } else {
            ans+=1
            cnt.removeValue(forKey:inpt[j])
        }
    }
}
ans+=cnt.count/4
print(ans)
0