Monday, May 2, 2016

UVA 11991: Easy Problem from Rujia Liu? - Slution

Unknown
#include<cstdio>
#include<vector>
using namespace std;

#define MX 1000005

int main()
{
    int size, query,b;
    while (scanf("%d%d",&size,&query)!=EOF)
    {
        vector <int> arr[MX];
        for (int i=1;i<=size;i++)
        {
        scanf("%d",&b);
        arr[b].push_back(i);
        }

        while (query--)
        {
            int occur,value;
            scanf("%d%d",&occur,&value);
            if (occur>arr[value].size()) printf("0\n");
            else printf("%d\n",arr[value][occur-1]);
        }
    }
    return 0;
}

Unknown

Studying at Shahjalal University of Science and Technology, Sylhet.

0 comments:

Post a Comment

Coprights @ 2016,