# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
23671 | leejseo | 사냥꾼 (KOI13_hunter) | C++14 | 83 ms | 2292 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <stdio.h>
#include <algorithm>
#include <time.h>
using namespace std;
struct point{
int x,y;
point () {}
point (int _x, int _y) { x=_x; y=_y; }
bool operator < (const point& rhs) const {return x < rhs.x; }
};
int m,n,l;
int x[100000];
point animal[100000];
int main()
{
scanf ("%d%d%d", &m, &n, &l);
for (int i=0; i<m; i++) scanf ("%d", &(x[i]));
for (int i=0; i<n; i++) scanf ("%d%d", &(animal[i].x), &(animal[i].y));
sort (x, x+m);
sort (animal, animal+n);
int answer = 0;
for (int i=0, j=0; i<n; i++)
{
while (j<m && x[j]<animal[i].x){
j++;
}
bool flag = false;
if ((j>0) && (animal[i].x - x[j-1] + animal[i].y <= l)) flag = true;
if ((j<m) && (x[j]-animal[i].x + animal[i].y <=l)) flag = true;
if (flag) answer ++;
}
printf("%d\n", answer);
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |