#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
map<int, int> ma;
int main(){
int n, m, t;
cin >> n >> m;
vector<int> v;
for (int i = 0; i < n; i++) {
cin >> t;
if(!ma[t]){
ma[t] = 1;
v.push_back(t);
}else{
ma[t]++;
}
}
sort(v.begin(), v.end());
for (int i = 0; i < v.size(); i++) {
int t = 1;
if(ma[v[i]] > 1) t = 0;
for (int j = i + t; j < v.size(); j++) {
if (v[i] + v[j] == m) {
cout << v[i] << ' ' << v[j] << endl;
return 0;
}
}
}
cout << "No Solution\n";
return 0;
}
1048. Find Coins (25)
猜你喜欢
转载自blog.csdn.net/qq_31474267/article/details/79559402
今日推荐
周排行