[Python] 10942번

체인지영·2021년 4월 10일
0

[Python] 백준

목록 보기
11/12
import sys
import math

def pal(nums):
    num_len = len(nums)
    half = math.floor(num_len/2);
    for i in range(half):
        if nums[i] != nums[num_len-i-1]:
            return 0
    return 1

N  = int(sys.stdin.readline())
nums = list(map(int,sys.stdin.readline().split()))
M = int(sys.stdin.readline())

for _ in range(M):
    S,E = map(int,sys.stdin.readline().split())
    check_nums = nums[S-1:E]
    print(pal(check_nums))

왜시간초과...?

profile
Startup, FrontEnd, BlockChain Developer

0개의 댓글