This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| struct GeneratedError<T>: Error { | |
| let host: T | |
| let id: Int | |
| let message: String | |
| let file: String | |
| let line: Int | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func setBit(_ x: Int, _ n: Int) -> Int { ... } | |
| func unsetBit(_ x: Int, _ n: Int) -> Int { ... } | |
| func reverseBit(_ x: Int, _ n: Int) -> Int { ... } | |
| func print8Bit(_ x: Int) { ... } | |
| // 標準入力から整数を読み込む | |
| // 整数以外であれば例外 | |
| func readInt() throws -> Int { ... } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| struct JoinedCollection<C1: Collection, C2: Collection, Element>: Collection | |
| where C1.Element == Element, C2.Element == Element, C1.Index == Int, C2.Index == Int { | |
| var left: C1 | |
| var right: C2 | |
| init(_ left: C1, _ right: C2) { | |
| self.left = left | |
| self.right = right | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let aa: [[Int]] = [ | |
| [768, 527, 845], | |
| [978, 444, 266], | |
| [777, 746, 419], | |
| [109, 58, 54], | |
| [544, 391, 391], | |
| [937, 308, 901], | |
| [105, 310, 594], | |
| [830, 795, 221], | |
| [792, 547, 688], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let aa = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3 ] | |
| func getInt() -> Int { aa.count } | |
| func getIntArray() -> [Int] { aa } | |
| /// | |
| let n = getInt() | |
| var dp = Array<Array<Int?>>(repeating: Array<Int?>(repeating: nil, count: n), count: n) | |
| dp[0] = getIntArray() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let aa = [0, 2, 7, 8] | |
| func getIntArray() -> [Int] { aa } | |
| /// | |
| var dp = Array<Array<Int?>>(repeating: Array<Int?>(repeating: nil, count: 4), count: 4) | |
| dp[0] = getIntArray() | |
| func solve(_ n: Int, _ m: Int) -> Int { | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let aa = [696, 300, 458, 384, 75, 431, 353, 626, 219, 941, 46, 816, 724, 361] | |
| func getInt2() -> (Int, Int) { (899, 14) } | |
| func getIntArray() -> [Int] { aa } | |
| /// | |
| let (n, m) = getInt2() | |
| let a = getIntArray() | |
| var dp = Array<Bool?>(repeating: nil, count: n + 1) | |
| dp[0] = true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let aa = [3, 1, 4, 1, 5, 9, 2, 6] | |
| func getInt2() -> (Int, Int) { (aa.count, 4) } | |
| func getIntArray() -> [Int] { aa } | |
| /// | |
| let (n, m) = getInt2() | |
| let a = getIntArray() | |
| var dp = Array<Int?>(repeating: nil, count: n) | |
| dp[0] = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| struct Reader: Sequence { | |
| struct Iterator: IteratorProtocol { | |
| func next() -> String? { | |
| readLine() | |
| } | |
| } | |
| func makeIterator() -> Iterator { | |
| .init() | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| struct Reader: Sequence { | |
| struct Iterator: IteratorProtocol { | |
| func next() -> String? { | |
| readLine() | |
| } | |
| } | |
| func makeIterator() -> Iterator { | |
| .init() | |
| } |
NewerOlder