Submission #17643029


Source Code Expand

let input = readLine()!.split(separator: " ")
let n = Int(input[0])!
let s = Array(input[1]).map{String($0)}
var answer = 0
for i in 0..<n-1{
    for j in i+1..<n{
        var ac = 0
        var tc = 0
        var cc = 0
        var gc = 0
        for k in i...j{
            if s[k] == "A"{ac += 1}
            if s[k] == "T"{tc += 1}
            if s[k] == "C"{cc += 1}
            if s[k] == "G"{gc += 1} 
        }
        if ac == tc && cc == gc{answer += 1}
    }
}
print(answer)

Submission Info

Submission Time
Task B - DNA Sequence
User tardigrade
Language Swift (5.2.1)
Score 0
Code Size 504 Byte
Status TLE
Exec Time 2205 ms
Memory 8196 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 3
AC × 4
TLE × 14
Set Name Test Cases
Sample s1.txt, s2.txt, s3.txt
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, s1.txt, s2.txt, s3.txt
Case Name Status Exec Time Memory
01.txt TLE 2205 ms 7968 KiB
02.txt TLE 2205 ms 7468 KiB
03.txt TLE 2205 ms 7824 KiB
04.txt TLE 2205 ms 7824 KiB
05.txt TLE 2205 ms 7532 KiB
06.txt TLE 2205 ms 7636 KiB
07.txt TLE 2205 ms 7464 KiB
08.txt TLE 2205 ms 7528 KiB
09.txt TLE 2205 ms 7968 KiB
10.txt TLE 2205 ms 7736 KiB
11.txt AC 14 ms 8196 KiB
12.txt TLE 2205 ms 7976 KiB
13.txt TLE 2205 ms 7628 KiB
14.txt TLE 2205 ms 7776 KiB
15.txt TLE 2205 ms 7636 KiB
s1.txt AC 11 ms 7952 KiB
s2.txt AC 5 ms 7772 KiB
s3.txt AC 10 ms 8120 KiB