Skip to content

Commit

Permalink
fix sum2val
Browse files Browse the repository at this point in the history
  • Loading branch information
megargayu committed Oct 22, 2022
1 parent 9231356 commit 72a0716
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions cses/sortingsearching/sum2val/sum2val.cpp
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
// https://cses.fi/problemset/task/1640/

#include <bits/stdc++.h>
using namespace std;

#define MAX_N 200000
#define ll long long

array<pair<ll, int>, MAX_N> arr;
int main()
{
int n, x;
ll n, x;
cin >> n >> x;

for (int i = 0; i < n; ++i)
{
cin >> arr[i].first;
arr[i].second = i;
}

sort(arr.begin(), arr.begin() + n, [](const auto &a, const auto &b)
{
return a.first < b.first;
});

sort(arr.begin(), arr.begin() + n);

int i = 0, j = n - 1;
while (i < j)
{
Expand All @@ -34,7 +30,7 @@ int main()
return 0;
}
}

cout << "IMPOSSIBLE\n";
return 0;
}

0 comments on commit 72a0716

Please sign in to comment.