Jaydeep999997

Debug

Feb 28th, 2021
500
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <bits/stdc++.h>
  2.  
  3. #define num 1000000007
  4. #define formn(i,m,n) for(i=m;i<n;i++)
  5. #define forn(i,n) for(i=0;i<n;i++)
  6. #define fmno(i,m,n,o) for(i=m;i<n;i+=o)
  7. #define ll long long
  8.  
  9. using namespace std;
  10.  
  11.  
  12. int main() {
  13.     long long i=0,j,k,n,t;
  14.     cin>>t;
  15.     while(t--)
  16.     {
  17.         cin>>n;
  18.         k=0;
  19.         vector<string> a(n);
  20.         set<string> b;
  21.         multiset<string> c;
  22.         ll ini;
  23.         forn(i,n)
  24.         {
  25.             cin>>a[i];
  26.             c.insert(a[i]);
  27.         }
  28.         forn(ini,n)
  29.         {
  30.             i=b.size();
  31.             b.insert(a[ini]);
  32.             c.erase(c.find(a[ini]));
  33.             char ch='0',p;
  34.             for(int j=3;j>=0;j--)
  35.             while(b.size()<=i)
  36.             {
  37.                 p=a[ini][j];
  38.                 a[ini][j]= ch;
  39.                 if(c.find(a[ini])==c.end() && b.find(a[ini])==b.end())
  40.                 {
  41.                     k++;
  42.                     b.insert(a[ini]);
  43.                     break;
  44.                 }
  45.                 a[ini][j]=p;
  46.                 ch = ch + 1;
  47.                 //cout<<ch;
  48.             }
  49.         }
  50.         cout<<k<<'\n';
  51.         forn(i,n)
  52.         {
  53.             cout<<a[i]<<" ";
  54.         }
  55.         cout<<'\n';
  56.  
  57.     }
  58.    
  59.     return 0;
  60. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×