Guest User

Untitled

a guest
Feb 14th, 2020
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  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;
  13. set <string> q;
  14. vector <string> s(n);
  15. map <string, bool> check;
  16.  
  17.  
  18. for (int i = 0; i < n; i++) {
  19. cin >> c;
  20. if (c[1] != '?') {
  21. q.insert(c);
  22. ch1++;
  23. check[c] = 1;
  24. s[i] = c;
  25. continue;
  26. } else {
  27. int j = 0;
  28. for (j = 0; j < 100; j++) {
  29. c[1] = (j / 10) + '0';
  30. c[2] = (j % 10) + '0';
  31. if (check[c] == 0) {
  32. check[c] = 1;
  33. break;
  34. }
  35. }
  36. if (check[c] == 1 && j == 100) {
  37. cout << "NO";
  38. return 0;
  39. }
  40. }
  41. s[i] = c;
  42. }
  43. if (q.size() != ch1) {
  44. cout << "NO";
  45. return 0;
  46. }
  47. cout << "YES" << endl;
  48. for (int i = 0; i < n; i++) {
  49. cout << s[i] << endl;
  50. }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment