結果
問題 | 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 countdry = 0left, right = 0, size - 1while left < right:current_sum = a_sorted[left] + a_sorted[right]if current_sum < 0:dry += 1left += 1right -= 1else:right -= 1# Calculate maximum Wet countwet = 0left, right = 0, size - 1while left < right:current_sum = a_sorted[left] + a_sorted[right]if current_sum > 0:wet += 1left += 1right -= 1else:left += 1# Calculate maximum Moist countmoist = 0left, right = 0, size - 1while left < right:current_sum = a_sorted[left] + a_sorted[right]if current_sum == 0:moist += 1left += 1right -= 1elif current_sum > 0:right -= 1else:left += 1print(dry, wet, moist)