QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#837059 | #1441. Special Game | mjkim112358 | RE | 9ms | 10640kb | Python3 | 496b | 2024-12-29 14:44:19 | 2024-12-29 14:44:19 |
Judging History
answer
n=int(input())
a=sorted(map(int,input().split()))
b=sorted(map(int,input().split()))
x=n
ans=0
t=1
while a:
if(a[-1]<b[0]):
if(t==0):ans+=len(a)
break
if(b[-1]<a[0]):
if(t==1):ans+=len(a)
break
z=[-10**20,10**20];j=0
for i in range(x):
while j<x and a[i]>=b[j]:j+=1
if(j==n):break
if(z[0]-z[1]<i-j):z=[i,j]
a.pop(z[0])
b.pop(z[1])
a,b=b,a
if(t==0):ans+=1
t=1-t
x-=1
print(ans)
詳細信息
Test #1:
score: 100
Accepted
time: 8ms
memory: 10524kb
input:
3 1 2 5 3 4 6
output:
1
result:
ok "1"
Test #2:
score: 0
Accepted
time: 8ms
memory: 10552kb
input:
2 4 3 1 2
output:
2
result:
ok "2"
Test #3:
score: 0
Accepted
time: 8ms
memory: 10640kb
input:
1 1 2
output:
0
result:
ok "0"
Test #4:
score: 0
Accepted
time: 9ms
memory: 10640kb
input:
9 2 12 10 3 4 7 17 14 16 6 1 13 11 9 15 18 8 5
output:
5
result:
ok "5"
Test #5:
score: -100
Dangerous Syscalls
input:
9 1 3 2 14 15 13 8 6 7 12 11 4 17 9 5 18 10 16