답안 #4547

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
4547 2013-10-26T11:04:27 Z cki86201 사냥꾼 (KOI13_hunter) C++
100 / 100
76 ms 2260 KB
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<vector>
#include<math.h>
#include<stdlib.h>
#include<set>
#include<ctype.h>
using namespace std;

#define X first
#define Y second
typedef long long ll;
typedef pair<int,int> Pi;

int p[100010];
int a[100010],b[100010];
int n,m;

int get_min(int x)
{
	int st=1,en=n,mi,ret=0;
	while(st<=en){
		mi=(st+en)>>1;
		if(p[mi]<=x)st=mi+1,ret=mi;
		else en=mi-1;
	}
	if(ret==0)return abs(p[1]-x);
	if(ret!=n)return min(abs(p[ret]-x),abs(p[ret+1]-x));
	return abs(p[ret]-x);
}

int main()
{
	int i,c=0,l;
	scanf("%d%d%d",&n,&m,&l);
	for(i=1;i<=n;i++)scanf("%d",p+i);
	sort(p+1,p+1+n);
	for(i=1;i<=m;i++)scanf("%d%d",a+i,b+i);
	for(i=1;i<=m;i++){
		if(get_min(a[i])+b[i]<=l)c++;
	}
	printf("%d\n",c);
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2260 KB Output is correct
2 Correct 0 ms 2260 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2260 KB Output is correct
2 Correct 0 ms 2260 KB Output is correct
3 Correct 0 ms 2260 KB Output is correct
4 Correct 0 ms 2260 KB Output is correct
5 Correct 0 ms 2260 KB Output is correct
6 Correct 0 ms 2260 KB Output is correct
7 Correct 0 ms 2260 KB Output is correct
8 Correct 0 ms 2260 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2260 KB Output is correct
2 Correct 0 ms 2260 KB Output is correct
3 Correct 0 ms 2260 KB Output is correct
4 Correct 0 ms 2260 KB Output is correct
5 Correct 0 ms 2260 KB Output is correct
6 Correct 0 ms 2260 KB Output is correct
7 Correct 0 ms 2260 KB Output is correct
8 Correct 0 ms 2260 KB Output is correct
9 Correct 0 ms 2260 KB Output is correct
10 Correct 0 ms 2260 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2260 KB Output is correct
2 Correct 0 ms 2260 KB Output is correct
3 Correct 0 ms 2260 KB Output is correct
4 Correct 0 ms 2260 KB Output is correct
5 Correct 0 ms 2260 KB Output is correct
6 Correct 0 ms 2260 KB Output is correct
7 Correct 0 ms 2260 KB Output is correct
8 Correct 0 ms 2260 KB Output is correct
9 Correct 0 ms 2260 KB Output is correct
10 Correct 0 ms 2260 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 32 ms 2260 KB Output is correct
2 Correct 44 ms 2260 KB Output is correct
3 Correct 52 ms 2260 KB Output is correct
4 Correct 44 ms 2260 KB Output is correct
5 Correct 60 ms 2260 KB Output is correct
6 Correct 60 ms 2260 KB Output is correct
7 Correct 64 ms 2260 KB Output is correct
8 Correct 56 ms 2260 KB Output is correct
9 Correct 76 ms 2260 KB Output is correct
10 Correct 56 ms 2260 KB Output is correct