QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#121429#5642. DA-Sortkaitlinz0 27ms8580kbPython3832b2023-07-08 06:08:142023-07-08 06:08:14

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-08 06:08:14]
  • 评测
  • 测评结果:0
  • 用时:27ms
  • 内存:8580kb
  • [2023-07-08 06:08:14]
  • 提交

answer


# Online Python - IDE, Editor, Compiler, Interpreter

def ceiling_division(n, d):
    q, r = divmod(n, d)
    return q + bool(r)
    
def solve(arr):
    newArr = sorted(arr[:])
    idx, newidx = 0,0
    
    while idx < len(arr) and newidx < len(newArr):
        print(arr[idx], " ", newArr[newidx])
        if arr[idx] == newArr[newidx]:
            idx+=1 
            newidx+=1 
        else: # arr[idx] < newArr[newidx]:
            idx += 1
    return len(newArr) - newidx
            
        
        
        
setNum = int(input())
for i in range(setNum):
    probNum, elems = [int(x) for x in input().split()]
    arr = []
    for j in range(ceiling_division(elems, 10)):
        arr += [int(x) for x in input().split()]
    print(sorted(arr))
    print(arr)
    print(solve(arr))

    

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 27ms
memory: 8580kb

input:

50
1 3
1 3 2
2 6
1 5 2 4 3 6
3 23
67890 56312 999999999 12345 23456 38927 45632 100345 98765 23456
87654 43278 23456 117654 321899 25432 54326 217435 26845 31782
33456 41234 56213
4 1000
18780 15256 15263 15268 15269 15274 15279 15279 15283 15290
15292 15292 15295 15298 15302 15305 15305 15311 15316...

output:

[1, 2, 3]
[1, 3, 2]
1   1
3   2
2   2
1
[1, 2, 3, 4, 5, 6]
[1, 5, 2, 4, 3, 6]
1   1
5   2
2   2
4   3
3   3
6   4
3
[12345, 23456, 23456, 23456, 25432, 26845, 31782, 33456, 38927, 41234, 43278, 45632, 54326, 56213, 56312, 67890, 87654, 98765, 100345, 117654, 217435, 321899, 999999999]
[67890, 56312,...

result:

wrong answer 1st lines differ - expected: '1 1', found: '[1, 2, 3]'