結果

問題 No.706 多眼生物の調査
ユーザー MaboyMaboy
提出日時 2021-06-21 21:04:22
言語 Swift
(5.10.0)
結果
WA  
実行時間 -
コード長 405 bytes
コンパイル時間 2,272 ms
コンパイル使用メモリ 180,716 KB
実行使用メモリ 15,008 KB
最終ジャッジ日時 2023-09-05 01:55:49
合計ジャッジ時間 4,226 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 7 ms
14,428 KB
testcase_01 AC 7 ms
14,300 KB
testcase_02 AC 7 ms
14,212 KB
testcase_03 WA -
testcase_04 AC 59 ms
14,276 KB
testcase_05 AC 248 ms
14,812 KB
testcase_06 WA -
testcase_07 AC 6 ms
14,172 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import Foundation
let n = Int(readLine()!)!
var l = [Int]()
for _ in 1...n{
    let s = readLine()!
    l += [s.count - s.replacingOccurrences(of: "^", with: "").count]
}
var d = [Int:Int]()
let s = Set(l)

for i in s{
    var c = 0
    for j in l{
        c += i == j ? 1 : 0
    }
    d[i] = c
}
var k = 0
var v = 0
for i in d{
    if i.value >= v{
        v = i.value
        k = i.key
    }
}
print(k)
0