提出 #75896927


ソースコード 拡げる

#include <stdio.h>

#define KI_MAX (1 << 19) /* 524288 */
#define INF 1010101010

int ki[KI_MAX * 2 - 1];

void ki_set(int pos, int value) {
	pos += KI_MAX - 1;
	ki[pos] = value;
	do {
		pos = (pos - 1) / 2;
		ki[pos] = ki[pos * 2 + 1];
		if (ki[pos * 2 + 2] < ki[pos]) ki[pos] = ki[pos * 2 + 2];
	} while (pos > 0);
}

int N, Q;
int A[312345];
int K[212345];
int B[212345][5];

int main(void) {
	int i, j;
	if (scanf("%d%d", &N, &Q) != 2) return 1;
	for (i = 0; i < N; i++) {
		if (scanf("%d", &A[i]) != 1) return 1;
	}
	for (i = 0; i < Q; i++) {
		if (scanf("%d", &K[i]) != 1) return 1;
		for (j = 0; j < K[i]; j++) {
			if (scanf("%d", &B[i][j]) != 1) return 1;
			B[i][j]--;
		}
	}

	for (i = 0; i < N; i++) ki[KI_MAX - 1 + i] = A[i];
	for (i = N; i < KI_MAX; i++) ki[KI_MAX - 1 + i] = INF;
	for (i = KI_MAX - 2; i >= 0; i--) {
		ki[i] = ki[i * 2 + 1];
		if (ki[i * 2 + 2] < ki[i]) ki[i] = ki[i * 2 + 2];
	}

	for (i = 0; i < Q; i++) {
		for (j = 0; j < K[i]; j++) ki_set(B[i][j], INF);
		printf("%d\n", ki[0]);
		for (j = 0; j < K[i]; j++) ki_set(B[i][j], A[B[i][j]]);
	}
	return 0;
}

提出情報

提出日時
問題 C - Except and Min
ユーザ mikecat
言語 C23 (GCC 14.2.0)
得点 300
コード長 1140 Byte
結果 AC
実行時間 86 ms
メモリ 10152 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 1
AC × 19
セット名 テストケース
Sample 00_sample_00.txt
All 00_sample_00.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 02_random_2_00.txt, 02_random_2_01.txt, 02_random_2_02.txt, 02_random_2_03.txt, 02_random_2_04.txt, 02_random_2_05.txt, 03_random_3_00.txt, 03_random_3_01.txt, 03_random_3_02.txt, 03_random_3_03.txt, 03_random_3_04.txt, 03_random_3_05.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 2 ms 5800 KiB
01_random_00.txt AC 86 ms 10096 KiB
01_random_01.txt AC 80 ms 10116 KiB
01_random_02.txt AC 86 ms 10052 KiB
01_random_03.txt AC 86 ms 10116 KiB
01_random_04.txt AC 85 ms 10048 KiB
01_random_05.txt AC 84 ms 10108 KiB
02_random_2_00.txt AC 85 ms 10144 KiB
02_random_2_01.txt AC 83 ms 10144 KiB
02_random_2_02.txt AC 80 ms 10068 KiB
02_random_2_03.txt AC 84 ms 10108 KiB
02_random_2_04.txt AC 78 ms 10128 KiB
02_random_2_05.txt AC 78 ms 10116 KiB
03_random_3_00.txt AC 82 ms 10152 KiB
03_random_3_01.txt AC 81 ms 10136 KiB
03_random_3_02.txt AC 82 ms 10128 KiB
03_random_3_03.txt AC 83 ms 10128 KiB
03_random_3_04.txt AC 83 ms 10136 KiB
03_random_3_05.txt AC 81 ms 10144 KiB