結果
問題 | No.2221 Set X |
ユーザー | titia |
提出日時 | 2023-02-19 00:53:02 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 786 bytes |
コンパイル時間 | 292 ms |
コンパイル使用メモリ | 86,976 KB |
実行使用メモリ | 87,040 KB |
最終ジャッジ日時 | 2023-09-27 12:38:02 |
合計ジャッジ時間 | 7,342 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 66 ms
71,412 KB |
testcase_01 | AC | 67 ms
71,392 KB |
testcase_02 | AC | 69 ms
71,288 KB |
testcase_03 | AC | 68 ms
71,232 KB |
testcase_04 | AC | 67 ms
71,184 KB |
testcase_05 | AC | 64 ms
71,084 KB |
testcase_06 | AC | 66 ms
71,396 KB |
testcase_07 | AC | 65 ms
71,420 KB |
testcase_08 | AC | 78 ms
75,568 KB |
testcase_09 | AC | 70 ms
75,188 KB |
testcase_10 | AC | 77 ms
75,696 KB |
testcase_11 | AC | 75 ms
75,632 KB |
testcase_12 | AC | 72 ms
75,768 KB |
testcase_13 | AC | 76 ms
75,752 KB |
testcase_14 | AC | 81 ms
75,812 KB |
testcase_15 | AC | 78 ms
75,868 KB |
testcase_16 | AC | 324 ms
80,280 KB |
testcase_17 | AC | 164 ms
77,124 KB |
testcase_18 | AC | 376 ms
80,984 KB |
testcase_19 | AC | 157 ms
77,260 KB |
testcase_20 | AC | 259 ms
78,424 KB |
testcase_21 | TLE | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
testcase_36 | -- | - |
testcase_37 | -- | - |
testcase_38 | -- | - |
testcase_39 | -- | - |
testcase_40 | -- | - |
testcase_41 | -- | - |
testcase_42 | -- | - |
ソースコード
def calc(x): score=1 for i in range(1,N): if A[i]//x!=A[i-1]//x: score+=1 return score*(x+1) def calc2(x): score=1 now=A[0]//x OK=0 while True: NG=len(A) while NG>OK+1: mid=(OK+NG)//2 if A[mid]//x==now: OK=mid else: NG=mid if NG==len(A): break else: score+=1 now=A[NG]//x OK=NG return score*(x+1) N=int(input()) A=list(map(int,input().split())) ANS=1<<100 IND=-1 for i in range(1,100): k=calc(i) if k<ANS: ANS=k IND=i for i in range(100,ANS+1): k=calc2(i) if k<ANS: ANS=k IND=i print(IND) print(ANS)