Submission

Status:

PPP-PPPP-P

Subtask/Task Score:

80/100

Score: 80

User: Sense.exe

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

Language: cpp

Time: 0.005 second

Submitted On: 2026-10-07 19:01:25

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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,temp,lucky;
    cin >> n;
    vector<int> v;
    vector<bool> is(n,false);
    for(int i=0; i<n; i++) {
        cin >> temp;
        v.push_back(temp);
    }
    cin >> lucky;
    bool is_true = false;
    for(int i=0; i<n; i++) {
        for(int j=i+1; j<n; j++) {
            if((v[i]+v[j]==lucky)&&(is[j]==false&&is[i]==false)) {
                cout << v[i] << " " << v[j] << "\n";
                v[i] = true;
                v[j] = true;
                is_true = true;
            }
        }
    }
    if(!is_true) cout << "No";
}