| Task: | 3SUM |
| Sender: | aalto26gm_019 |
| Submission time: | 2026-10-19 16:34:07 +0300 |
| Language: | C++ (C++23) |
| Status: | COMPILE ERROR |
Compiler report
input/code.cpp: In function 'int main()':
input/code.cpp:20:10: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
20 | std::sort(arr.begin(), arr.end());
| ^~~~
| qsortCode
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
ll n, x;
cin >> n >> x;
vector<pair<ll, int>> arr(n);
for (int i = 0; i < n; i++) {
ll val;
cin >> val;
arr[i] = {val, i};
}
std::sort(arr.begin(), arr.end());
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
for (int k = j + 1; k < n; k++) {
ll sum = arr[i].first + arr[j].first + arr[k].first;
if (sum > x) {
cout << "IMPOSSIBLE\n";
return 0;
}
if (sum == x) {
cout << arr[i].second + 1 << " " << arr[j].second + 1 << " "
<< arr[k].second + 1 << "\n";
return 0;
}
}
}
}
cout << "IMPOSSIBLE\n";
return 0;
}
