Skip to content

Commit 18a98d0

Browse files
committed
atcoder/abc064B (feedback from editorial)
1 parent 900713d commit 18a98d0

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

atcoder/abc064/B/main.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,9 @@ int N;
77
vector<int> A;
88

99
int solve() {
10-
sort(A.begin(), A.end());
11-
int ans = 0;
12-
for (int i = 1; i < N; ++i) {
13-
ans += A[i] - A[i-1];
14-
}
15-
return ans;
10+
int mini = *min_element(A.begin(), A.end());
11+
int maxi = *max_element(A.begin(), A.end());
12+
return maxi - mini;
1613
}
1714

1815
int main() {

0 commit comments

Comments
 (0)