Submission
Status:
PPP--PPP--
Score: 60
User: Namkhing
Problemset: จับคู่เลขมงคล
Language: cpp
Time: 0.003 second
Submitted On: 2025-04-11 15:31:51
#include <bits/stdc++.h>
using namespace std;
int main() {
cin.tie(nullptr)->ios_base::sync_with_stdio(false);
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) cin >> a[i];
int x;
cin >> x;
set<int> have;
bool ok = false;
for (int i = 0; i < n; i++) {
if (have.find(x - a[i]) != have.end()) {
cout << x - a[i] << " " << a[i] << "\n";
ok = true;
}
have.insert(a[i]);
}
if (!ok) cout << "No";
}