Submission #198946

# Submission time Handle Problem Language Result Execution time Memory
198946 2020-01-28T09:23:05 Z David Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) Python 3
0 / 100
3000 ms 238528 KB
def MOOD(l, r, W1):
    Mood = []
    w = W1[l - 1:r]
    pl = w.copy()
    pl.sort()
    mood = 0
    for i in range(0, r + 1 - l):
        if i == pl.index(w[i]):
            continue
        else:
            mood = max(w[i:w.index(pl[i])]) + pl[i]
            w.insert(i, w.pop(w.index(pl[i])))
            Mood.append(mood)
    return max(Mood)


nm = input().split(' ')
N, M = int(nm[0]), int(nm[1])
W = input().split(' ')
Task = []
for i in range(M):
    Task.append(input().split(' '))
for i in range(M):
    if MOOD(int(Task[i][0]), int(Task[i][1]), W) <= int(Task[i][2]):
        print(1)
    else:
        print(0)
# Verdict Execution time Memory Grader output
1 Runtime error 30 ms 3344 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 30 ms 3344 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3388 ms 238528 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 388 ms 45332 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 30 ms 3344 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 30 ms 3344 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -