Sunday, 14 February 2016

Where Are My Genes (UVALive 3473, POJ 2867, Regionals 2005 >> Latin America - South America)

///     Raihan Ruhin
///     CSE, Jahangirnagar University.
///     Dhaka-Bangladesh.
///     id: raihanruhin (topcoder / codeforces / codechef / uva / uvalive / spoj), 3235 (lightoj)
///     mail: raihanruhin@ (yahoo / gmail / facebook)
///     blog: ruhinraihan.blogspot.com

#include<bits/stdc++.h>
using namespace std;

#define SET(a) memset(a,-1,sizeof(a))
#define CLR(a) memset(a,0,sizeof(a))
#define PI acos(-1.0)

#define MOD 1000000007
#define MX 100000

int arr[50000+5], l[1000+5], r[1000+5];

int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);
    int tc, kk=1, n, rev, q, x;
    while(cin>>n && n)
    {
        cin>>rev;
        //for(int i=1;i<=n;i++) arr[i]=i;
        for(int i=0;i<rev;i++)
        {
            cin>>l[i]>>r[i];
        }
        cin>>q;
        cout<<"Genome "<<kk++<<"\n";
        while(q--)
        {
            cin>>x;
            for(int i=0;i<rev;i++)
                if(l[i]<=x && x<=r[i])
                    x = l[i]+r[i]-x;
            cout<<x<<"\n";
        }

    }

return 0;
}

No comments:

Post a Comment