Advertisement
Fahim_7861

RECONSTRUCT THE GENOME 5.2

Dec 19th, 2020
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.26 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. typedef long long ll;
  4. typedef unsigned long long ull;
  5. typedef pair<ll,ll>pll;
  6. typedef pair<ll,pair<ll,ll>>plll;
  7. #define fastread() (ios_base:: sync_with_stdio(false),cin.tie(NULL));
  8. #define vll(v) v.begin(),v.end()
  9. #define all(x) x.rbegin(),x.rend()
  10. #define min3(a, b, c) min(a, min(b, c))
  11. #define max3(a, b, c) max(a, max(b, c))
  12. #define F first
  13. #define S second
  14. #define in freopen("input.txt", "r", stdin)
  15. #define out freopen("output.txt", "w", stdout)
  16. #define minheap int,vector<int>,greater<int>
  17. #define pb push_back
  18. #define eb emplace_back
  19. #define ischar(x) (('a' <= x && x <= 'z') || ('A' <= x && x <= 'Z'))
  20. #define isvowel(ch) ((ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')||(ch=='A'|| ch=='E' || ch=='I'|| ch=='O'|| ch=='U'))
  21. #define bug cout<<"BUG"<<endl;
  22. const int Max = 2e5 + 10;
  23. const int Mod = 1e9 + 7;
  24. const double PI =3.141592653589793238463;
  25. bool compare(const string &a, const string &b)
  26. {
  27. for(ll i=0; i<a.size(); i++)
  28. {
  29. if(a[i]!=b[i] && (a[i]=='$' || b[i]=='$'))
  30. {
  31.  
  32. if(a[i]=='$')return 1;
  33.  
  34. else if(b[i]=='$')return 0;
  35. }
  36.  
  37. else if(a[i]<b[i])return 1;
  38.  
  39. else if(a[i]>b[i])return 0;
  40. }
  41.  
  42. return 1;
  43. }
  44. ll lcm(ll a,ll b)
  45. {
  46. if(a==0 || b==0)return 0;
  47.  
  48. return a/__gcd(a,b)*b;
  49. }
  50.  
  51. void input(ll ara[],ll n)
  52. {
  53. for(ll i=0; i<n; i++)cin>>ara[i];
  54. }
  55. void print(ll ara[],ll n)
  56. {
  57. for(ll i=0; i<n; i++)
  58. cout<<ara[i]<<" ";
  59. cout<<endl;
  60. }
  61.  
  62.  
  63. int main()
  64. {
  65.  
  66. fastread();
  67.  
  68. ll i,j,n,m,p,a,sum=0,k,t,b,c,d,cnt=0,q,l,r,ans=0;
  69.  
  70. bool flag=false;
  71.  
  72.  
  73.  
  74. string genome;
  75.  
  76. cout<<"input the genome"<<endl;
  77.  
  78. cin>>genome;
  79.  
  80. n=genome.size();
  81.  
  82. string bwt[n],currentBwt[n];
  83.  
  84. for(i=0; i<n; i++)
  85. {
  86.  
  87. currentBwt[i]=bwt[i]=genome[i];
  88. }
  89.  
  90. sort(currentBwt,currentBwt+n,compare);
  91.  
  92. cout<<endl;
  93.  
  94. while(currentBwt[0].size()<n)
  95. {
  96.  
  97. for(i=0; i<n; i++)
  98. currentBwt[i]=bwt[i]+currentBwt[i];
  99.  
  100. sort(currentBwt,currentBwt+n,compare);
  101.  
  102. for(i=0; i<n; i++)
  103. cout<<currentBwt[i]<<endl;
  104.  
  105. cout<<endl<<endl;
  106. }
  107.  
  108.  
  109. for(i=0; i<n; i++)
  110. cout<<currentBwt[i]<<endl;
  111.  
  112.  
  113.  
  114.  
  115. }
  116.  
  117.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement