QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#121428#5642. DA-SortkaitlinzCompile Error//C++14832b2023-07-08 06:07:532023-07-08 06:07:54

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:07:54]
  • 评测
  • [2023-07-08 06:07:53]
  • 提交

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))

    

详细

answer.code:2:3: error: invalid preprocessing directive #Online; did you mean #line?
    2 | # Online Python - IDE, Editor, Compiler, Interpreter
      |   ^~~~~~
      |   line
answer.code:17:15: error: stray ‘#’ in program
   17 |         else: # arr[idx] < newArr[newidx]:
      |               ^
answer.code:4:1: error: ‘def’ does not name a type
    4 | def ceiling_division(n, d):
      | ^~~