結果

問題 No.1268 Fruit Rush 2
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2020-10-31 18:20:33
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 407 ms / 2,000 ms
コード長 497 bytes
コンパイル時間 99 ms
コンパイル使用メモリ 10,792 KB
実行使用メモリ 42,876 KB
最終ジャッジ日時 2023-09-29 10:32:50
合計ジャッジ時間 7,689 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,864 KB
testcase_01 AC 15 ms
7,876 KB
testcase_02 AC 16 ms
7,816 KB
testcase_03 AC 16 ms
7,760 KB
testcase_04 AC 16 ms
7,860 KB
testcase_05 AC 16 ms
7,880 KB
testcase_06 AC 14 ms
7,868 KB
testcase_07 AC 15 ms
7,872 KB
testcase_08 AC 15 ms
7,784 KB
testcase_09 AC 15 ms
7,876 KB
testcase_10 AC 15 ms
7,892 KB
testcase_11 AC 15 ms
7,844 KB
testcase_12 AC 14 ms
7,840 KB
testcase_13 AC 14 ms
7,876 KB
testcase_14 AC 14 ms
7,892 KB
testcase_15 AC 15 ms
7,816 KB
testcase_16 AC 257 ms
25,940 KB
testcase_17 AC 220 ms
24,764 KB
testcase_18 AC 239 ms
26,044 KB
testcase_19 AC 231 ms
25,164 KB
testcase_20 AC 231 ms
24,928 KB
testcase_21 AC 219 ms
24,644 KB
testcase_22 AC 265 ms
25,940 KB
testcase_23 AC 264 ms
25,896 KB
testcase_24 AC 233 ms
25,164 KB
testcase_25 AC 222 ms
24,744 KB
testcase_26 AC 310 ms
39,612 KB
testcase_27 AC 307 ms
39,684 KB
testcase_28 AC 305 ms
39,592 KB
testcase_29 AC 315 ms
39,568 KB
testcase_30 AC 314 ms
39,688 KB
testcase_31 AC 393 ms
38,412 KB
testcase_32 AC 407 ms
38,328 KB
testcase_33 AC 319 ms
42,872 KB
testcase_34 AC 261 ms
39,680 KB
testcase_35 AC 291 ms
42,876 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int,input().split()))
a.sort()

dic = {}
for i in range(n):
    dic[a[i]] = i

ans = n
used = [0]*n
for i in range(1,n):
    if used[i]:
        continue
    used[i] = 1
    if a[i] == a[i-1]+1:
        count = 1
        s = 1
        k = a[i]
        ans += 1
        while k+count*2 in dic:
            ans += s
            if k+count*2-1 in dic:
                s += 1
                ans += 1
            used[dic[k+count*2]] = 1
            count += 1
print(ans)
0