Submission

Status:

P-P--P-P--

Subtask/Task Score:

40/100

Score: 40

User: sakurajima

Problemset: จับคู่เลขมงคล

Language: cpp

Time: 0.004 second

Submitted On: 2026-09-27 16:28:39

#include <bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n, lucky; 
    cin >> n;

    vector<int> birth(n);
    unordered_map<int, int> mp;
    for (int i = 0; i < n; i++) {
        cin >> birth[i];
    }

    cin >> lucky;
    bool is_empty = true;
    
    for (int i = 0; i < n; i++) {
        int target = lucky - birth[i];
        if (mp.count(target)) {
            cout << target << " " << birth[i] << '\n';
            is_empty = false;
        }
        mp[birth[i]] = i;
    }

    if (is_empty) {
        cout << "NO";
    }

}