Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- #define flush cin.ignore(numeric_limits<streamsize>::max(),'\n')
- #define fasterio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
- #define NL printf("\n")
- //who cares? I want to give some scary looks to my code... XD//
- typedef long long int ll;
- typedef double dl;
- typedef unsigned long long ul;
- // ------------------------------------Constants-------------------------------------//
- #define pi acos(-1.0) //3.1415926535897932384626
- #define mx 7500000
- #define dpoint(x) fixed<<setprecision(x)
- #define mod 1000000007
- #define pb push_back
- #define scn(x) scanf("%d",&x)
- #define scnd(x) scanf("%lf",&x)
- // --------------------------Pre made Functions & Proto Type--------------------------//
- template <class T> T gcd(T a, T b){if(a == 0) return b;return gcd ( b%a, a );}
- template <class T> T lcm(T a, T b){return ( ( a/gcd ( a, b ) )*b );}
- template <class T> T digitsum(T n){T sum=0;while(n!=0){sum+=n%10;n/=10;}return sum;}
- // --------------------------------------Global--------------------------------------//
- // -------------------------------------slove----------------------------------------//
- //Code Status :ac ;name: ;
- int main()
- {
- #ifndef ONLINE_JUDGE
- freopen("input.txt","r",stdin);
- freopen("ans.txt","w",stdout);
- #endif
- vector<string> s;
- int t;
- cin>>t;
- flush;
- for(int i=1; i<=t; i++)
- {
- s.pb("http://www.lightoj.com/");
- string value, url;
- int backLenth=0, forwardLenth=0, tmp=0, f=0;
- cout<<"Case "<<i<<":"<<endl;
- while(cin>>value)
- {
- if(tmp==100 || value=="QUIT")break;
- else if(value=="VISIT")
- {
- cin>>url;
- s.pb(url);
- cout<<s[s.size()-1]<<endl;
- backLenth++;
- //forwardLenth=0;
- }
- else if(value=="BACK")
- {
- if(backLenth==0)
- {
- cout<<"Ignored"<<endl;
- s.pop_back();
- }
- else {
- cout<<s[--backLenth]<<endl;
- forwardLenth++;
- }
- }
- else if(value=="FORWARD")
- {
- if(forwardLenth<=backLenth)cout<<"Ignored"<<endl;
- else{
- cout<<s[++backLenth]<<endl;
- forwardLenth--;
- }
- }
- tmp++;
- }
- s.clear();
- }
- return 0;
- }
- /// ----------------------------Funaction Descriptions----------------------------------//
- //author anikaksh;
- //trust me ur the competitor of your own, not ur friend!
- //Thanks To My Seniors and frndzz who help me all the time's
- //Contest link:
Add Comment
Please, Sign In to add comment