Task: | 3-sum |
Sender: | Jan Studený - account for testing |
Submission time: | 2020-09-01 11:38:00 +0300 |
Language: | C++ (C++17) |
Status: | BUSTED |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:16:5: error: 'sort' was not declared in this scope sort(begin(v),end(v)); ^~~~ input/code.cpp:16:5: note: suggested alternative: 'qsort' sort(begin(v),end(v)); ^~~~ qsort
Code
//#include <bits/stdc++.h> #include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int> v; for(int i=0;i<n;i++) { int c; cin >> c; v.push_back(c); } sort(begin(v),end(v)); cout << *(end(v)-1) << " " << *(end(v)-2) << " " << *(end(v)-3) << endl; }