SHARE
TWEET

Untitled

a guest Feb 14th, 2020 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.     set <string> q;
  13.     map <string, bool> check;
  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.             check[t[i]] = 1;
  20.             ch1++;
  21.             s[i] = t[i];
  22.             continue;
  23.         }
  24.     }
  25.     if (q.size() != ch1) {
  26.         cout << "NO";
  27.         return 0;
  28.     }
  29.     for (int i = 0; i < n; i++) {
  30.         string c = t[i];
  31.         if (c[1] != '?') continue;
  32.         int flag = 0;
  33.         for (int j = 0; j < 100; j++) {
  34.             c[1] = (j / 10) + '0';
  35.             c[2] = (j % 10) + '0';
  36.             if (check[c] == 0) {
  37.                 flag = 1;
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top