Submission #38678655


Source Code Expand

Copy
#
import itertools
N = int(input())
A = [int(e) for e in input().split()]
cumsum_A = [0] + list(itertools.accumulate(A)) # (1-index)
Q = int(input())
for i in range(Q):
L,R = map(int, input().split())
draw = R - L + 1
win = cumsum_A[R] - cumsum_A[L-1]
lose = draw - win
if win > lose:
print("win")
elif win < lose:
print("lose")
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# 途中変化なしなリストの区間の合計を求める → 累積和

import itertools

N = int(input())
A = [int(e) for e in input().split()]
cumsum_A = [0] + list(itertools.accumulate(A))      # 累積和の作成(1-index)

Q = int(input())

for i in range(Q):
    L,R = map(int, input().split())
    
    draw = R - L + 1
    win = cumsum_A[R] - cumsum_A[L-1]
    lose = draw - win

    if win > lose:
        print("win")
    elif win < lose:
        print("lose")
    elif win == lose:
        print("draw")

Submission Info

Submission Time
Task B06 - Lottery
User tonomotohide
Language Python (3.8.2)
Score 1000
Code Size 542 Byte
Status AC
Exec Time 471 ms
Memory 14580 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 1000 / 1000
Status
AC × 1
AC × 16
Set Name Test Cases
Sample sample01.txt
All random00.txt, random01.txt, random02.txt, random03.txt, random04.txt, random05.txt, random06.txt, random07.txt, random08.txt, random09.txt, random10.txt, random11.txt, random12.txt, random13.txt, random14.txt, sample01.txt
Case Name Status Exec Time Memory
random00.txt AC 269 ms 14580 KB
random01.txt AC 163 ms 10652 KB
random02.txt AC 438 ms 13408 KB
random03.txt AC 34 ms 10940 KB
random04.txt AC 431 ms 9168 KB
random05.txt AC 328 ms 11336 KB
random06.txt AC 471 ms 14348 KB
random07.txt AC 115 ms 10056 KB
random08.txt AC 269 ms 8940 KB
random09.txt AC 194 ms 11644 KB
random10.txt AC 291 ms 9756 KB
random11.txt AC 76 ms 11804 KB
random12.txt AC 296 ms 11328 KB
random13.txt AC 228 ms 12360 KB
random14.txt AC 123 ms 14268 KB
sample01.txt AC 18 ms 9016 KB


2025-04-15 (Tue)
18:43:07 +00:00