Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main() {
- ios_base::sync_with_stdio(0);
- cin.tie(0); cout.tie(0);
- freopen("input.txt", "r", stdin);
- freopen("output.txt", "w", stdout);
- int n, ch1 = 0;
- cin >> n;
- set <string> q;
- map <string, bool> check;
- vector <string> s(n), t(n);
- for (int i = 0; i < n; i++) {
- cin >> t[i];
- if (t[i][1] != '?') {
- q.insert(t[i]);
- check[t[i]] = 1;
- ch1++;
- s[i] = t[i];
- continue;
- }
- }
- if (q.size() != ch1) {
- cout << "NO";
- return 0;
- }
- for (int i = 0; i < n; i++) {
- string c = t[i];
- if (c[1] != '?') continue;
- int flag = 0;
- for (int j = 0; j < 100; j++) {
- c[1] = (j / 10) + '0';
- c[2] = (j % 10) + '0';
- if (check[c] == 0) {
- flag = 1;
- break;
- }
- }
- if (flag) check[c] = 1;
- else {
- cout << "NO";
- return 0;
- }
- s[i] = c;
- }
- cout << "YES" << endl;
- for (int i = 0; i < n; i++) {
- cout << s[i] << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement