/ SeriousOJ /

Record Detail

Memory Exceeded


  
# Status Time Cost Memory Cost
#1 Memory Exceeded foo.rb: --> foo.rb Unmatched keyword, missing `end' ? > 4 queries = [int(input()) for _ in range(Q)] > 6 min_value = float('inf') > 7 min_index = -1 > 9 for i in range(N): > 10 if A[i] < min_value: > 14 for X in queries: > 15 print(min_index + 1) > 16 A[min_index] = X > 17 min_value = float('inf') > 18 for i in range(N): > 19 if A[i] < min_value: foo.rb:4: syntax error, unexpected `for', expecting ']' (SyntaxError) queries = [int(input()) for _ in range(Q)] ^~~ ≥393ms ≥256.016 MiB
#2 Memory Exceeded foo.rb: --> foo.rb Unmatched keyword, missing `end' ? > 4 queries = [int(input()) for _ in range(Q)] > 6 min_value = float('inf') > 7 min_index = -1 > 9 for i in range(N): > 10 if A[i] < min_value: > 14 for X in queries: > 15 print(min_index + 1) > 16 A[min_index] = X > 17 min_value = float('inf') > 18 for i in range(N): > 19 if A[i] < min_value: foo.rb:4: syntax error, unexpected `for', expecting ']' (SyntaxError) queries = [int(input()) for _ in range(Q)] ^~~ ≥397ms ≥256.016 MiB

Code

N = int(input())
A = list(map(int, input().split()))
Q = int(input())
queries = [int(input()) for _ in range(Q)]

min_value = float('inf')
min_index = -1

for i in range(N):
    if A[i] < min_value:
        min_value = A[i]
        min_index = i

for X in queries:
    print(min_index + 1)
    A[min_index] = X
    min_value = float('inf')
    for i in range(N):
        if A[i] < min_value:
            min_value = A[i]
            min_index = i

Information

Submit By
Type
Submission
Problem
P1086 KuZ the Position
Contest
Bangladesh 2.0
Language
Ruby 3 (Ruby 3.2.3)
Submit At
2024-08-16 16:00:43
Judged At
2024-11-11 03:16:31
Judged By
Score
0
Total Time
≥397ms
Peak Memory
≥256.016 MiB