結果
問題 | No.1007 コイン集め |
ユーザー | vwxyz |
提出日時 | 2023-11-23 01:35:11 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,061 bytes |
コンパイル時間 | 352 ms |
コンパイル使用メモリ | 81,700 KB |
実行使用メモリ | 104,160 KB |
最終ジャッジ日時 | 2023-11-23 01:35:16 |
合計ジャッジ時間 | 5,108 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 142 ms
89,056 KB |
testcase_01 | AC | 137 ms
89,056 KB |
testcase_02 | AC | 144 ms
89,056 KB |
testcase_03 | AC | 145 ms
89,056 KB |
testcase_04 | AC | 138 ms
89,056 KB |
testcase_05 | AC | 139 ms
89,056 KB |
testcase_06 | AC | 138 ms
89,056 KB |
testcase_07 | AC | 145 ms
89,056 KB |
testcase_08 | AC | 138 ms
89,056 KB |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | AC | 141 ms
89,056 KB |
testcase_12 | AC | 169 ms
103,904 KB |
testcase_13 | AC | 165 ms
103,904 KB |
testcase_14 | AC | 163 ms
103,904 KB |
testcase_15 | AC | 154 ms
101,216 KB |
testcase_16 | AC | 158 ms
101,216 KB |
testcase_17 | AC | 153 ms
101,216 KB |
testcase_18 | AC | 161 ms
104,160 KB |
testcase_19 | AC | 184 ms
103,264 KB |
testcase_20 | WA | - |
testcase_21 | AC | 192 ms
103,776 KB |
ソースコード
import bisect import copy import decimal import fractions import heapq import itertools import math import random import sys import time from collections import Counter,deque,defaultdict from functools import lru_cache,reduce from heapq import heappush,heappop,heapify,heappushpop,_heappop_max,_heapify_max def _heappush_max(heap,item): heap.append(item) heapq._siftdown_max(heap, 0, len(heap)-1) def _heappushpop_max(heap, item): if heap and item < heap[0]: item, heap[0] = heap[0], item heapq._siftup_max(heap, 0) return item from math import gcd as GCD read=sys.stdin.read readline=sys.stdin.readline readlines=sys.stdin.readlines write=sys.stdout.write #import pypyjit #pypyjit.set_param('max_unroll_recursion=-1') #sys.set_int_max_str_digits(10**9) N,K=map(int,readline().split()) A=list(map(int,readline().split())) K-=1 l,r=max(0,K-1),min(N,K+2) while l and A[l]>=2: l-=1 while r<N and A[r-1]>=2: r+=1 if A[K]>=2: ans=sum(A[l:r]) elif A[K]==1: ans=min(sum(A[l:K+1]),sum(A[K:r])) else: ans=0 print(ans)