結果

問題 No.1006 Share an Integer
ユーザー 👑 timitimi
提出日時 2020-10-14 17:22:19
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 360 bytes
コンパイル時間 326 ms
コンパイル使用メモリ 86,892 KB
実行使用メモリ 108,100 KB
最終ジャッジ日時 2023-09-28 00:40:46
合計ジャッジ時間 16,370 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 605 ms
107,040 KB
testcase_01 AC 633 ms
107,072 KB
testcase_02 AC 621 ms
107,004 KB
testcase_03 WA -
testcase_04 AC 631 ms
107,136 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 612 ms
107,144 KB
testcase_09 AC 690 ms
107,216 KB
testcase_10 AC 639 ms
107,184 KB
testcase_11 AC 725 ms
107,436 KB
testcase_12 AC 642 ms
107,404 KB
testcase_13 AC 666 ms
107,868 KB
testcase_14 AC 651 ms
107,960 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 648 ms
107,600 KB
testcase_19 AC 641 ms
107,428 KB
testcase_20 AC 660 ms
107,428 KB
testcase_21 AC 652 ms
107,928 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
x=2*(10**6)
D=[0]*(2*x+2)
for i in range(1,2*x+2):
  d=i
  D[i]+=-1+i
  while d+i<=2*x:
    d+=i
    D[d]-=1
A=[]
n=x
for i in range(1,N):
  a,b=i,N-i
  if a>=b:
    break
  d=abs(D[a]-D[b])
  if n==d:
    A.append((a,b))
    A.append((b,a))
  elif n>d:
    A=[]
    n=d
    A.append((a,b))
    A.append((b,a))
for a,b in sorted(A):
  print(a,b)
0