結果

問題 No.29 パワーアップ
コンテスト
ユーザー バカらっく
提出日時 2018-03-01 14:08:18
言語 Swift
(6.2.4)
コンパイル:
swiftc _filename_ -Ounchecked -o a.out
実行:
./a.out
結果
AC  
実行時間 4 ms / 5,000 ms
+ 228µs
コード長 381 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 12,386 ms
コンパイル使用メモリ 151,280 KB
実行使用メモリ 10,496 KB
最終ジャッジ日時 2026-07-15 22:02:43
合計ジャッジ時間 12,382 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.swift:5:5: warning: immutable value 'i' was never used; consider replacing with '_' or removing it [#no-usage]
 3 | var cnt = [Int:Int]()
 4 | var ans = 0
 5 | for i in 1...inputCount {
   |     `- warning: immutable value 'i' was never used; consider replacing with '_' or removing it [#no-usage]
 6 |     let inpt = readLine()!.split(separator: " ").map{Int($0)!}
 7 |     for j in 0...inpt.count-1

ソースコード

diff #
raw source code

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