結果
問題 | No.190 Dry Wet Moist |
ユーザー |
![]() |
提出日時 | 2025-03-20 21:04:18 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 132 ms / 2,000 ms |
コード長 | 889 bytes |
コンパイル時間 | 166 ms |
コンパイル使用メモリ | 82,640 KB |
実行使用メモリ | 108,832 KB |
最終ジャッジ日時 | 2025-03-20 21:04:30 |
合計ジャッジ時間 | 3,865 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 28 |
ソースコード
n = int(input()) a = list(map(int, input().split())) a_sorted = sorted(a) size = 2 * n # Calculate maximum Dry count dry = 0 left, right = 0, size - 1 while left < right: current_sum = a_sorted[left] + a_sorted[right] if current_sum < 0: dry += 1 left += 1 right -= 1 else: right -= 1 # Calculate maximum Wet count wet = 0 left, right = 0, size - 1 while left < right: current_sum = a_sorted[left] + a_sorted[right] if current_sum > 0: wet += 1 left += 1 right -= 1 else: left += 1 # Calculate maximum Moist count moist = 0 left, right = 0, size - 1 while left < right: current_sum = a_sorted[left] + a_sorted[right] if current_sum == 0: moist += 1 left += 1 right -= 1 elif current_sum > 0: right -= 1 else: left += 1 print(dry, wet, moist)