diff --git a/zeta_C/completed/19637.c b/zeta_C/completed/19637.c new file mode 100644 index 0000000..4920ab7 --- /dev/null +++ b/zeta_C/completed/19637.c @@ -0,0 +1,41 @@ +#include +#include + +typedef struct TitleCondition { + char title[12]; + int condition; +} TitleCondition; + +TitleCondition total[100000]; +int N, M; + +// tc[i-1] < x <= tc[i]일 때, tc[i] +TitleCondition *get_title(int x) { + int start = -1, end = N; + int mid; + + while (start + 1 < end) { + mid = (start + end) / 2; + if (total[mid].condition < x) { + start = mid; + } else { + end = mid; + } + } + + return total + end; +} + +int main() { + scanf("%d %d", &N, &M); + for (int i = 0; i < N; i++) { + scanf("%s %d", &total[i].title, &total[i].condition); + } + int temp; + for (int i = 0; i < M; i++) { + scanf("%d", &temp); + printf("%s\n", get_title(temp)->title); + } + + return 0; +} \ No newline at end of file