We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8b1fe3e commit f4dc51eCopy full SHA for f4dc51e
2 files changed
백준/Gold/2470. 두 용액/README.md
@@ -4,15 +4,15 @@
4
5
### 성능 요약
6
7
-메모리: 78352 KB, 시간: 68 ms
+메모리: 78352 KB, 시간: 64 ms
8
9
### 분류
10
11
이분 탐색, 정렬, 두 포인터
12
13
### 제출 일자
14
15
-2025년 5월 8일 11:32:02
+2025년 5월 8일 11:35:21
16
17
### 문제 설명
18
백준/Gold/2470. 두 용액/두 용액.swift
@@ -10,7 +10,9 @@ while true {
break
}
// 특성값의 합이 전보다 작으면, 특성값을 갱신한다.
- if abs(0-(valueList[start] + valueList[end])) < abs(0-minSum) {
+ let curDiff = 0-(valueList[start] + valueList[end]) > 0 ? 0-(valueList[start] + valueList[end]) : -(0-(valueList[start] + valueList[end]))
+ let oldDiff = 0-minSum > 0 ? 0-minSum : -(0-minSum)
+ if curDiff < oldDiff {
v1 = valueList[start]
v2 = valueList[end]
minSum = valueList[start] + valueList[end]
0 commit comments