結果

問題 No.1268 Fruit Rush 2
コンテスト
ユーザー ayaoni
提出日時 2020-10-24 00:11:23
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 334 ms / 2,000 ms
コード長 843 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 301 ms
コンパイル使用メモリ 85,040 KB
実行使用メモリ 214,648 KB
最終ジャッジ日時 2026-04-03 04:55:10
合計ジャッジ時間 6,440 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge1_1
純コード判定待ち
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import sys
from collections import defaultdict
sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def LS2(): return list(sys.stdin.readline().rstrip())


N = I()
A = LI()
A.sort()
d = defaultdict(int)
for a in A:
    d[a] = 1

flag = defaultdict(int)
for a in A:
    flag[a] = 0

for a in A:
    if flag[a] == 0:
        b = a
        while d[b] == 1:
            b += 2
        r = (b-a)//2
        for i in range(a,b,2):
            flag[i] = r-(i-a)//2

ans = N
for a in A:
    ans += flag[a+1]

print(ans)
0