About Me

About Me : I have been working as a Software Engineer for various international companies for four years.Currently, I am working as a full stack Javascript developer in Petronas(Malaysia).

Skills

Skills • Javascript •Typescript •Python •C •Java •ReactJs • Redux • VueJs • NestJs • React Testing Library • Django• PostgreSQL • MySQL • NodeJs • Git • Docker • Jira • Visual Studio Code • Slack

বৃহস্পতিবার, ৫ ফেব্রুয়ারী, ২০১৫

UVA :482 permutation array

#include<iostream>
#include<cstdio>
#include<string>
#include<map>
#include<algorithm>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<vector>
#include<stack>
#define inf 100000000
#define pi acos(-1.0)
#define READ freopen("in.txt","r",stdin);
#define WRITE freopen ("out.txt","w",stdout);
#define maax 1000006
using namespace std;


char ss[400000];

int main()
{
  //  READ WRITE
    int test;

    vector<int >a;
    vector<int >res;
    vector<string>b;
    map<int , string>mp;
    map<int , string>::iterator it;


    scanf("%d", &test);
    getchar();


    for (int cas = 1; cas <= test; cas++)
    {
        getchar();
        if(cas>1) printf("\n");
        mp.clear();
        a.clear();
        res.clear();
        b.clear();

        gets(ss);
        char *ptr = strtok(ss, " ");
        while (ptr != NULL)
        {

            a.push_back(atoi(ptr));
            res.push_back(atoi(ptr));
            ptr = strtok(NULL, " ");

        }
        gets(ss);
        char *pt = strtok(ss, " ");
        while (pt != NULL)
        {
            string s = pt;
            b.push_back(s);
            pt = strtok(NULL, " ");

        }

       // sort(res.begin(), res.end());


        for (int i = 0; i < b.size(); i++)
        {
            mp[res[i] ]= b[i];
        }

        for(it=mp.begin();it!=mp.end();it++)
        {
            cout<<it->second<<endl;
        }


    }

    return 0;
}




কোন মন্তব্য নেই:

একটি মন্তব্য পোস্ট করুন