UV 11991-easy problem from rujia Liu?

Source: Internet
Author: User

This question indicates the number of N input, and the number of M groups. Each group contains two integer k and V, which indicates the position where the integer v appears at the K th time.

# Include <cstdio> # include <map> # include <vector> using namespace STD; int main () {Map <int, vector <int> mm; // here we use the map and vector int n, m, K, V, I, A; while (scanf ("% d", & N, & M )! = EOF) {mm. clear (); for (I = 1; I <= N; I ++) {scanf ("% d", & A); mm [A]. push_back (I) ;}while (M --) {scanf ("% d", & K, & V); If (Mm [v]. size () <k) printf ("0 \ n"); else printf ("% d \ n", Mm [v] [k-1]) ;}} return 0 ;}

CodeIt's easy to understand. It's mainly about map and vector usage.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.