提出 #55093893
ソースコード 拡げる
// AtCoder Beginner Contest 359
import Foundation
func main() {
let (N, T) = read2Ints()
let S = readStringsFromNoSpace()
let X = readInts()
var count = 0
for i in 0..<N {
for j in i+1..<N {
// 蟻iが正、蟻jが負
if S[i] == "1" && S[j] == "0" {
// 初期位置の条件を満たす場合
if X[i] < X[j] && X[j] - X[i] <= 2 * T {
count += 1
continue
}
break
}
}
}
print(count)
}
main()
// MARK: - 入力
// 参考:
// https://github.com/kntkymt/AtCoderBeginnersSelection_Swift
func readInt() -> Int {
return Int(Int64(readLine()!)!)
}
func read2Ints(separator: String.Element = " ") -> (a: Int, b: Int) {
let ints = readLine()!.split(separator: separator).map { Int(String($0))! }
return (a: ints[0], b: ints[1])
}
func read3Ints(separator: String.Element = " ") -> (a: Int, b: Int, c: Int) {
let ints = readLine()!.split(separator: separator).map { Int(String($0))! }
return (a: ints[0], b: ints[1], c: ints[2])
}
func read4Ints(separator: String.Element = " ") -> (a: Int, b: Int, c: Int, d: Int) {
let ints = readLine()!.split(separator: separator).map { Int(String($0))! }
return (a: ints[0], b: ints[1], c: ints[2], d: ints[3])
}
func readInts(separator: String.Element = " ") -> [Int] {
return readLine()!.split(separator: separator).map { Int(String($0))! }
}
func readIntsFromNoSpace() -> [Int] {
return readLine()!.map { Int(String($0))! }
}
func readString() -> String {
return readLine()!
}
func read2Strings(separator: String.Element = " ") -> (a: String, b: String) {
let strings = readLine()!.split(separator: separator).map { String($0) }
return (a: strings[0], b: strings[1])
}
func read3Strings(separator: String.Element = " ") -> (a: String, b: String, c: String) {
let strings = readLine()!.split(separator: separator).map { String($0) }
return (a: strings[0], b: strings[1], c: strings[2])
}
func read4Strings(separator: String.Element = " ") -> (a: String, b: String, c: String, d: String) {
let strings = readLine()!.split(separator: separator).map { String($0) }
return (a: strings[0], b: strings[1], c: strings[2], d: strings[3])
}
func readStrings(separator: String.Element = " ") -> [String] {
return readLine()!.split(separator: separator).map { String($0) }
}
func readStringsFromNoSpace() -> [String] {
return readLine()!.map { String($0) }
}
提出情報
提出日時
2024-06-30 22:33:23+0900
問題
D - Ghost Ants
ユーザ
akidon0000
言語
Swift (swift 5.8.1)
得点
0
コード長
2636 Byte
結果
TLE
実行時間
2208 ms
メモリ
31300 KiB
コンパイルエラー
[0/1] Planning build
Building for production...
[0/2] Compiling _NumericsShims _NumericsShims.c
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
[2/3] Compiling RealModule AlgebraicField.swift
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
[4/5] Compiling OrderedCollections _HashTable+Bucket.swift
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
[6/7] Compiling DequeModule Compatibility.swift
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
[8/9] Compiling Algorithms AdjacentPairs.swift
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
[10/11] Compiling Collections Collections.swift
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
[12/13] Compiling Main main.swift
[13/14] Linking Main
Build complete! (9.06s)
ジャッジ結果
セット名
Sample
All
得点 / 配点
0 / 0
0 / 350
結果
セット名
テストケース
Sample
00_sample_00.txt, 00_sample_01.txt
All
00_sample_00.txt, 00_sample_01.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 01_random_20.txt, 01_random_21.txt, 01_random_22.txt, 01_random_23.txt, 01_random_24.txt, 01_random_25.txt
ケース名
結果
実行時間
メモリ
00_sample_00.txt
AC
4 ms
14732 KiB
00_sample_01.txt
AC
4 ms
14640 KiB
01_random_00.txt
TLE
2208 ms
31300 KiB
01_random_01.txt
TLE
2208 ms
24764 KiB
01_random_02.txt
TLE
2208 ms
31216 KiB
01_random_03.txt
TLE
2208 ms
30092 KiB
01_random_04.txt
TLE
2208 ms
31260 KiB
01_random_05.txt
TLE
2208 ms
22544 KiB
01_random_06.txt
TLE
2208 ms
31156 KiB
01_random_07.txt
TLE
2208 ms
30000 KiB
01_random_08.txt
TLE
2208 ms
31164 KiB
01_random_09.txt
TLE
2208 ms
30588 KiB
01_random_10.txt
TLE
2208 ms
31208 KiB
01_random_11.txt
TLE
2208 ms
30648 KiB
01_random_12.txt
TLE
2208 ms
31184 KiB
01_random_13.txt
TLE
2208 ms
27748 KiB
01_random_14.txt
TLE
2208 ms
31132 KiB
01_random_15.txt
TLE
2208 ms
22532 KiB
01_random_16.txt
TLE
2208 ms
31108 KiB
01_random_17.txt
TLE
2208 ms
30172 KiB
01_random_18.txt
TLE
2208 ms
31216 KiB
01_random_19.txt
TLE
2208 ms
30476 KiB
01_random_20.txt
TLE
2208 ms
31072 KiB
01_random_21.txt
TLE
2208 ms
31184 KiB
01_random_22.txt
TLE
2208 ms
31228 KiB
01_random_23.txt
TLE
2208 ms
31136 KiB
01_random_24.txt
TLE
2208 ms
31256 KiB
01_random_25.txt
TLE
2208 ms
31160 KiB