View difference between Paste ID: 7vK94xmR and MMvBbLS6
SHOW: | | - or go back to the newest paste.
1
#include<bits/stdc++.h>
2
3
using namespace std;
4
5
int main() {
6
    ios_base::sync_with_stdio(0);
7
    cin.tie(0); cout.tie(0);
8
    freopen("input.txt", "r", stdin);
9
    freopen("output.txt", "w", stdout);
10
    int n, ch1 = 0;
11
    cin >> n;
12-
    string c;
12+
13
    map <string, bool> check;
14-
    vector <string> s(n);
14+
    vector <string> s(n), t(n);
15
    for (int i = 0; i < n; i++) {
16
        cin >> t[i];
17
        if (t[i][1] != '?') {
18
            q.insert(t[i]);
19-
        cin >> c;
19+
            check[t[i]] = 1;
20-
        if (c[1] != '?') {
20+
21-
            q.insert(c);
21+
            s[i] = t[i];
22
            continue;
23-
            check[c] = 1;
23+
24-
            s[i] = c;
24+
25
    if (q.size() != ch1) {
26-
        } else {
26+
27-
            int j = 0;
27+
28-
            for (j = 0; j < 100; j++) {
28+
29-
                c[1] = (j / 10) + '0';
29+
30-
                c[2] = (j % 10) + '0';
30+
        string c = t[i];
31-
                if (check[c] == 0) {
31+
        if (c[1] != '?') continue;
32-
                    check[c] = 1;
32+
        int flag = 0;
33-
                    break;
33+
        for (int j = 0; j < 100; j++) {
34-
                }
34+
            c[1] = (j / 10) + '0';
35
            c[2] = (j % 10) + '0';
36-
            if (check[c] == 1 && j == 100) {
36+
            if (check[c] == 0) {
37-
                cout << "NO";
37+
                flag = 1;
38-
                return 0;
38+
                break;
39
            }
40
        }
41
        if (flag) check[c] = 1;
42
        else {
43
            cout << "NO";
44
            return 0;
45
        }
46
        s[i] = c;
47
    }
48
    cout << "YES" << endl;
49
    for (int i = 0; i < n; i++) {
50
        cout << s[i] << endl;
51
    }
52
}