General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
55665170 Practice:
G.E.M.
1181D - 53 GNU C++11 Accepted 374 ms 5880 KB 2019-06-17 05:52:24 2019-06-17 05:52:24
→ Source
#include<bits/stdc++.h>
using namespace std;
const int N=500002;
long long a[N],t;
int n,m,q,i,cnt[N],x;
int main(){
	scanf("%d%d%d",&n,&m,&q);
	for (i=1;i<=n;i++) scanf("%d",&x),a[i]=1ll*(cnt[x]++)*m+x;
	sort(a+1,a+n+1);
	for (i=1;i<=n;i++) a[i]-=i;
	for (;q--;){
		scanf("%lld",&t),t-=n;
		if (t>a[n]) t+=n;
		else t+=lower_bound(a+1,a+n+1,t)-a-1;
		printf("%lld\n",(t-1)%m+1);
	}
}
?
Time: ? ms, memory: ? KB
Verdict: ?
Input
?
Participant's output
?
Jury's answer
?
Checker comment
?
Diagnostics
?
Click to see test details