結果
| 問題 | No.190 Dry Wet Moist |
| コンテスト | |
| ユーザー |
maspy
|
| 提出日時 | 2020-03-05 16:44:05 |
| 言語 | Python3 (3.14.7 + numpy 2.5.2 + scipy 1.18.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 264 ms / 2,000 ms |
| + 485µs | |
| コード長 | 798 bytes |
| 記録 | |
| コンパイル時間 | 56 ms |
| コンパイル使用メモリ | 15,104 KB |
| 実行使用メモリ | 29,832 KB |
| 最終ジャッジ日時 | 2026-09-16 03:08:18 |
| 合計ジャッジ時間 | 5,467 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 28 |
ソースコード
#!/usr/bin/env python3
# %%
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from collections import deque
# %%
N, *A = map(int, read().split())
# %%
def dry(A):
A = deque(sorted(A))
ret = 0
while len(A) >= 2:
if A[0] + A[-1] < 0:
ret += 1
A.popleft()
A.pop()
else:
A.pop()
return ret
def wet(A):
return dry([-x for x in A])
def moist(A):
A = deque(sorted(A))
ret = 0
while len(A) >= 2:
x = A[0] + A[-1]
if x < 0:
A.popleft()
elif x > 0:
A.pop()
else:
A.popleft()
A.pop()
ret += 1
return ret
# %%
print(dry(A), wet(A), moist(A))
maspy