結果

問題 No.1268 Fruit Rush 2
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2020-10-31 18:04:49
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 465 bytes
コンパイル時間 534 ms
コンパイル使用メモリ 86,868 KB
実行使用メモリ 140,364 KB
最終ジャッジ日時 2023-09-29 10:32:11
合計ジャッジ時間 7,485 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,244 KB
testcase_01 AC 75 ms
71,108 KB
testcase_02 AC 73 ms
71,252 KB
testcase_03 AC 74 ms
71,356 KB
testcase_04 AC 73 ms
71,180 KB
testcase_05 AC 72 ms
71,408 KB
testcase_06 AC 72 ms
71,228 KB
testcase_07 AC 74 ms
71,224 KB
testcase_08 AC 75 ms
71,256 KB
testcase_09 AC 76 ms
71,044 KB
testcase_10 AC 76 ms
71,224 KB
testcase_11 AC 73 ms
71,484 KB
testcase_12 AC 73 ms
71,276 KB
testcase_13 AC 73 ms
71,332 KB
testcase_14 AC 74 ms
71,096 KB
testcase_15 AC 74 ms
71,392 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 212 ms
134,208 KB
testcase_27 AC 215 ms
134,296 KB
testcase_28 AC 210 ms
134,164 KB
testcase_29 AC 207 ms
134,216 KB
testcase_30 AC 207 ms
134,156 KB
testcase_31 AC 192 ms
112,184 KB
testcase_32 AC 192 ms
112,080 KB
testcase_33 AC 179 ms
140,320 KB
testcase_34 WA -
testcase_35 WA -
権限があれば一括ダウンロードができます

ソースコード

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 = 0
        s = 1
        k = a[i]
        while k+count*2 in dic:
            ans += s
            if k+count*2-1 in dic:
                s += 1
            used[dic[k+count*2]] = 1
            count += 1
        

print(ans)
0