| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 4949 | hana5505 | 사냥꾼 (KOI13_hunter) | C++98 | 76 ms | 12804 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<stdio.h>
#include<algorithm>
using namespace std;
struct pp{
int x,y;
}animal[1000001];
int hunter[1000001];
int ab(int k){
if(k<0) return -k;
return k;
}
int main()
{
int m,n,l,i,j,cnt=0,ans=0;
scanf("%d %d %d",&m,&n,&l);
for(i=1;i<=m;i++)
scanf("%d",&hunter[i]);
for(i=1;i<=n;i++)
scanf("%d %d",&animal[i].x,&animal[i].y);
sort(hunter+1,hunter+m+1);
for(i=1;i<=n;i++){
cnt=0;
j=lower_bound(hunter+1,hunter+m+1,animal[i].x)-hunter;
if(j-1>=1){
if(ab(hunter[j-1]-animal[i].x)+animal[i].y<=l) cnt++;
}
if(j>=1 && j<=m){
if(ab(hunter[j]-animal[i].x)+animal[i].y<=l) cnt++;
}
if(j+1<=m){
if(ab(hunter[j+1]-animal[i].x)+animal[i].y<=l) cnt++;
}
if(cnt) ans++;
}
printf("%d",ans);
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
