提出 #77657815
ソースコード 拡げる
Copy
#include <stdio.h>int N;int H[312345], L[312345];int Q;int T[312345];int max[312345];int main(void) {int i;if (scanf("%d", &N) != 1) return 1;for (i = 0; i < N; i++) {if (scanf("%d%d", &H[i], &L[i]) != 2) return 1;}if (scanf("%d", &Q) != 1) return 1;for (i = 0; i < Q; i++) {if (scanf("%d", &T[i]) != 1) return 1;}max[N - 1] = H[N - 1];for (i = N - 2; i >= 0; i--) {
#include <stdio.h>
int N;
int H[312345], L[312345];
int Q;
int T[312345];
int max[312345];
int main(void) {
int i;
if (scanf("%d", &N) != 1) return 1;
for (i = 0; i < N; i++) {
if (scanf("%d%d", &H[i], &L[i]) != 2) return 1;
}
if (scanf("%d", &Q) != 1) return 1;
for (i = 0; i < Q; i++) {
if (scanf("%d", &T[i]) != 1) return 1;
}
max[N - 1] = H[N - 1];
for (i = N - 2; i >= 0; i--) {
max[i] = H[i];
if (max[i + 1] > max[i]) max[i] = max[i + 1];
}
for (i = 0; i < Q; i++) {
int le = -1, g = N;
while (le + 1 < g) {
int m = le + (g - le) / 2;
if (L[m] > T[i]) g = m; else le = m;
}
printf("%d\n", max[g]);
}
return 0;
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | C - Tallest at the Moment |
| ユーザ | mikecat |
| 言語 | C23 (GCC 14.2.0) |
| 得点 | 300 |
| コード長 | 690 Byte |
| 結果 | AC |
| 実行時間 | 101 ms |
| メモリ | 8360 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 300 / 300 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | 00_sample_00.txt, 00_sample_01.txt |
| All | 00_sample_00.txt, 00_sample_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 01_random_20.txt, 01_random_21.txt, 01_random_22.txt, 01_random_23.txt, 01_random_24.txt, 01_random_25.txt, 01_random_26.txt, 01_random_27.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 00_sample_00.txt | AC | 0 ms | 1636 KiB |
| 00_sample_01.txt | AC | 0 ms | 1624 KiB |
| 01_random_02.txt | AC | 100 ms | 8108 KiB |
| 01_random_03.txt | AC | 99 ms | 8108 KiB |
| 01_random_04.txt | AC | 98 ms | 8112 KiB |
| 01_random_05.txt | AC | 99 ms | 8108 KiB |
| 01_random_06.txt | AC | 99 ms | 8112 KiB |
| 01_random_07.txt | AC | 46 ms | 3760 KiB |
| 01_random_08.txt | AC | 67 ms | 5552 KiB |
| 01_random_09.txt | AC | 100 ms | 8104 KiB |
| 01_random_10.txt | AC | 100 ms | 8104 KiB |
| 01_random_11.txt | AC | 100 ms | 8104 KiB |
| 01_random_12.txt | AC | 100 ms | 8104 KiB |
| 01_random_13.txt | AC | 101 ms | 8104 KiB |
| 01_random_14.txt | AC | 54 ms | 5440 KiB |
| 01_random_15.txt | AC | 23 ms | 2604 KiB |
| 01_random_16.txt | AC | 100 ms | 8104 KiB |
| 01_random_17.txt | AC | 99 ms | 8108 KiB |
| 01_random_18.txt | AC | 99 ms | 8108 KiB |
| 01_random_19.txt | AC | 100 ms | 8100 KiB |
| 01_random_20.txt | AC | 100 ms | 8108 KiB |
| 01_random_21.txt | AC | 40 ms | 4652 KiB |
| 01_random_22.txt | AC | 55 ms | 4780 KiB |
| 01_random_23.txt | AC | 62 ms | 8360 KiB |
| 01_random_24.txt | AC | 68 ms | 8104 KiB |
| 01_random_25.txt | AC | 69 ms | 8100 KiB |
| 01_random_26.txt | AC | 67 ms | 6360 KiB |
| 01_random_27.txt | AC | 0 ms | 1616 KiB |