fork download
  1. #include<iostream>
  2. #include<stdio.h>
  3. #include<string.h>
  4. #include<vector>
  5. #include<queue>
  6. #include<algorithm>
  7. #include<set>
  8. #include<math.h>
  9. #include<map>
  10. using namespace std;
  11.  
  12. #define mp make_pair
  13. #define pb push_back
  14.  
  15. #define STEP 100
  16.  
  17. typedef pair<int,int> pii;
  18. typedef pair<pii,int> piii;
  19.  
  20. int n;
  21. string s;
  22.  
  23. int sortIndex[STEP][1500];
  24.  
  25. int main()
  26. {
  27. cin>>s;
  28. n=s.size();
  29. memset(sortIndex,0,sizeof(sortIndex));
  30. for(int i=0;i<n;i++)
  31. sortIndex[0][i]=a[i]-'A';
  32. int doneTill=1;
  33. int step=1;
  34. while(doneTill < n) {
  35. vector <piii> L;
  36. for(int i=0;i<n;i++) {
  37. L.pb(piii( pii(sortIndex[step-1][i],sortIndex[step-1][i+doneTill]) ,i) );
  38. }
  39. sort(L.begin(),L.end());
  40. for(int i=0;i<n;i++) {
  41. int x1,x2,y1,y2;
  42. x1 = (L[i].first).first;
  43. y1 = (L[i].first).second;
  44. if(i!=0) {
  45. x2 = (L[i-1].first).first;
  46. y2 = (L[i-1].first).second;
  47. }
  48. if(x1==x2 && y1==y2)
  49. sortIndex[step][L[i].second] = sortIndex[step][L[i-1].second];
  50. else
  51. sortIndex[step][L[i].second] = i;
  52. }
  53. doneTill *= 2;
  54. step++;
  55. }
  56. cout<<"...\n";s
  57. for(int i=0;i<n;i++) {
  58. cout<<sortIndex[step-1][i];
  59. }
  60. }
  61.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:31:25: error: ‘a’ was not declared in this scope
         sortIndex[0][i]=a[i]-'A';
                         ^
prog.cpp:57:5: error: expected ‘;’ before ‘for’
     for(int i=0;i<n;i++) {
     ^~~
prog.cpp:57:17: error: ‘i’ was not declared in this scope
     for(int i=0;i<n;i++) {
                 ^
stdout
Standard output is empty