Anik_Akash

web update 1

Jan 21st, 2021 (edited)
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.26 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace    std;
  3.  
  4. #define flush        cin.ignore(numeric_limits<streamsize>::max(),'\n')
  5. #define fasterio     ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
  6. #define NL           printf("\n")
  7.  
  8.  
  9.  
  10. //who cares? I want to give some scary looks to my code... XD//
  11.  
  12.  
  13. typedef long long int       ll;
  14. typedef double              dl;
  15. typedef unsigned long long  ul;
  16.  
  17. // ------------------------------------Constants-------------------------------------//
  18.  
  19. #define pi           acos(-1.0) //3.1415926535897932384626
  20. #define mx           7500000
  21. #define dpoint(x)    fixed<<setprecision(x)
  22. #define mod          1000000007
  23. #define pb           push_back
  24. #define scn(x)       scanf("%d",&x)
  25. #define scnd(x)      scanf("%lf",&x)
  26.  
  27.  
  28. // --------------------------Pre made Functions & Proto Type--------------------------//
  29.  
  30. template <class T> T gcd(T a, T b){if(a == 0) return b;return gcd ( b%a, a );}
  31. template <class T> T lcm(T a, T b){return ( ( a/gcd ( a, b ) )*b );}
  32. template <class T> T digitsum(T n){T sum=0;while(n!=0){sum+=n%10;n/=10;}return sum;}
  33.  
  34.  
  35.  
  36.  // --------------------------------------Global--------------------------------------//
  37.  
  38.  
  39.  // -------------------------------------slove----------------------------------------//
  40.  //Code Status :ac ;name: ;
  41. int main()
  42. {
  43.    #ifndef ONLINE_JUDGE
  44.        freopen("input.txt","r",stdin);
  45.        freopen("ans.txt","w",stdout);
  46.    #endif
  47.         vector<string> s;
  48.        
  49.         int t;
  50.         cin>>t;
  51.         flush;
  52.         for(int i=1; i<=t; i++)
  53.         {
  54.              s.pb("http://www.lightoj.com/");
  55.               string value,  url;
  56.               int backLenth=0, forwardLenth=0, tmp=0, f=0;
  57.                 cout<<"Case "<<i<<":"<<endl;
  58.                 while(cin>>value)
  59.                 {
  60.                     if(tmp==100 || value=="QUIT")break;
  61.  
  62.                     else if(value=="VISIT")
  63.                     {
  64.                         cin>>url;
  65.                         s.pb(url);
  66.                         cout<<s[s.size()-1]<<endl;
  67.                         backLenth++;
  68.                         //forwardLenth=0;
  69.                     }
  70.                     else if(value=="BACK")
  71.                     {
  72.                           if(backLenth==0)
  73.                             {
  74.                                 cout<<"Ignored"<<endl;
  75.                                 s.pop_back();
  76.                             }
  77.                           else {
  78.                                 cout<<s[--backLenth]<<endl;
  79.                                 forwardLenth++;
  80.                           }
  81.                     }
  82.                     else if(value=="FORWARD")
  83.                     {
  84.                         if(forwardLenth<=backLenth)cout<<"Ignored"<<endl;
  85.                         else{
  86.                             cout<<s[++backLenth]<<endl;
  87.                             forwardLenth--;
  88.                         }
  89.                     }
  90.                     tmp++;
  91.                 }
  92.                 s.clear();
  93.         }
  94.     return 0;
  95. }
  96. /// ----------------------------Funaction Descriptions----------------------------------//
  97.  
  98.  
  99. //author anikaksh;
  100. //trust me ur the competitor of your own, not ur friend!
  101. //Thanks To My Seniors and frndzz who help me all the time's
  102. //Contest link:
  103.  
Add Comment
Please, Sign In to add comment