結果
問題 |
No.3016 ハチマキおじさん
|
ユーザー |
|
提出日時 | 2025-09-12 05:13:12 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 457 ms / 2,000 ms |
コード長 | 361 bytes |
コンパイル時間 | 403 ms |
コンパイル使用メモリ | 82,908 KB |
実行使用メモリ | 160,112 KB |
最終ジャッジ日時 | 2025-09-12 05:13:25 |
合計ジャッジ時間 | 12,800 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 31 |
ソースコード
n=int(input()) a=sorted(list(map(int,input().split()))) b=sorted(list(map(int,input().split()))) x=[0] y=[0] for i in range(n-1): x.append(x[-1]+abs(a[i]-b[i])) y.append(y[-1]+abs(a[i+1]-b[i])) z=[] for i in range(n): z.append((x[i]+y[-1]-y[i],i)) z.sort() ans=set() i=0 while i<n and z[i][0]==z[0][0]: ans.add(a[z[i][1]]) i+=1 print(len(ans)) print(*ans)