CSES - E4590 2019 0 - Results
Submission details
Task:3-sum
Sender:Eero Salla
Submission time:2019-09-06 08:31:07 +0300
Language:C++11
Status:COMPILE ERROR

Compiler report

input/code.cpp:5:5: warning: second argument of 'int main(int, int, int, int)' should be 'char **' [-Wmain]
 int main(int a, int b, int n, int t){
     ^~~~
input/code.cpp:5:5: warning: third argument of 'int main(int, int, int, int)' should probably be 'char **' [-Wmain]
input/code.cpp:5:5: warning: 'int main(int, int, int, int)' takes only zero or two arguments [-Wmain]
input/code.cpp: In function 'int main(int, int, int, int)':
input/code.cpp:15:3: error: no match for 'operator-=' (operand types are 'std::_Rb_tree_const_iterator<int>' and 'int')
 it-=i;
 ~~^~~

Code

#include <bits/stdc++.h>
using namespace std;
 
int main(int a, int b, int n, int t){
cin >> n;
multiset<int> num;
for(int i = 0; i < n; i++){
cin >> t;
num.insert(t);
}

for(int i = 0; i < 3; i++){
auto it = num.end();
it-=i;
cout << *it << " ";
}

}