답안 #827245

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
827245 2023-08-16T10:06:00 Z rainboy Brperm (RMI20_brperm) C
50 / 100
3000 ms 4156 KB
#include "brperm.h"
#include <stdlib.h>
#include <assert.h>

#define N	500000

char cc[N + 1]; int n;

void init(int n_, const char *cc_) {
	int i;

	n = n_;
	for (i = 0; i < n; i++)
		cc[i] = cc_[i];
}

int query(int i_, int k) {
	int n_, m, i, j;

	n_ = 1 << k;
	if (i_ + n_ > n)
		return 0;
	for (i = 0, j = 1; j < n_; j++) {
		for (m = n_ >> 1; ((i ^= m) & m) == 0; m >>= 1)
			;
		if (cc[i_ + i] != cc[i_ + j])
			return 0;
	}
	return 1;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 23 ms 1448 KB Output is correct
4 Correct 23 ms 1512 KB Output is correct
5 Correct 27 ms 1796 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3081 ms 4156 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 23 ms 1448 KB Output is correct
4 Correct 23 ms 1512 KB Output is correct
5 Correct 27 ms 1796 KB Output is correct
6 Execution timed out 3081 ms 4156 KB Time limit exceeded
7 Halted 0 ms 0 KB -