結果

問題 No.1006 Share an Integer
ユーザー 👑 timitimi
提出日時 2020-10-14 17:24:42
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 402 bytes
コンパイル時間 346 ms
コンパイル使用メモリ 87,072 KB
実行使用メモリ 108,244 KB
最終ジャッジ日時 2023-09-28 00:41:39
合計ジャッジ時間 16,097 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 608 ms
107,196 KB
testcase_01 AC 569 ms
107,240 KB
testcase_02 AC 631 ms
107,252 KB
testcase_03 AC 603 ms
107,124 KB
testcase_04 AC 618 ms
106,956 KB
testcase_05 WA -
testcase_06 AC 627 ms
107,140 KB
testcase_07 WA -
testcase_08 AC 698 ms
107,184 KB
testcase_09 AC 654 ms
107,076 KB
testcase_10 AC 670 ms
107,048 KB
testcase_11 AC 631 ms
107,476 KB
testcase_12 AC 651 ms
107,532 KB
testcase_13 AC 683 ms
108,076 KB
testcase_14 AC 631 ms
107,964 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 663 ms
107,452 KB
testcase_19 AC 661 ms
107,432 KB
testcase_20 AC 687 ms
107,472 KB
testcase_21 AC 662 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
  elif a==b:
    A.append((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