結果
問題 | No.706 多眼生物の調査 |
ユーザー |
|
提出日時 | 2021-06-21 21:28:43 |
言語 | Swift (6.0.3) |
結果 |
AC
|
実行時間 | 586 ms / 2,000 ms |
コード長 | 486 bytes |
コンパイル時間 | 1,961 ms |
コンパイル使用メモリ | 185,688 KB |
実行使用メモリ | 17,408 KB |
最終ジャッジ日時 | 2024-06-22 22:52:54 |
合計ジャッジ時間 | 3,387 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 5 |
ソースコード
import Foundationlet 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 = 0for j in l{c += i == j ? 1 : 0}d[i] = c}var k = 0var v = 0for i in d{if i.value > v{v = i.valuek = i.key}else if i.value == v{if i.key > k{k = i.key}}}print(k)