标签:blog http io os ar for sp on 2014
#include <stdio.h> #include <string.h> #include <iostream> #include <math.h> #include <algorithm> #include <vector> #include <map> #include <queue> #include <stack> #define PI acos(-1.0) #define eps 1e-8 #define LL long long #define moo 1000000007 #define INF -999999999 using namespace std; int num[510000]; map<int,int> ant; int n,m,u,v; int main() { while(~scanf("%d",&n)) { for(int i=1;i<=n;i++) scanf("%d",&num[i]); scanf("%d",&m); while(m--) { scanf("%d%d",&u,&v); ant.clear(); int i; for(i=v;i>=u;i--) { if(!ant.count(num[i])) ant[num[i]]=1; else { break; } } if(i<u) printf("OK\n"); else printf("%d\n",num[i]); } printf("\n"); } return 0; }
标签:blog http io os ar for sp on 2014
原文地址:http://blog.csdn.net/u013712847/article/details/40682557