結果

問題 No.1654 Binary Compression
ユーザー 👑 ygussanyygussany
提出日時 2021-06-17 22:31:27
言語 C
(gcc 12.3.0)
結果
TLE  
実行時間 -
コード長 1,156 bytes
コンパイル時間 240 ms
コンパイル使用メモリ 31,488 KB
実行使用メモリ 51,712 KB
最終ジャッジ日時 2024-04-22 04:00:04
合計ジャッジ時間 6,263 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
10,624 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 54 ms
27,136 KB
testcase_11 AC 55 ms
28,536 KB
testcase_12 AC 57 ms
28,160 KB
testcase_13 AC 56 ms
27,944 KB
testcase_14 AC 55 ms
27,264 KB
testcase_15 AC 61 ms
27,776 KB
testcase_16 AC 55 ms
51,712 KB
testcase_17 AC 56 ms
51,712 KB
testcase_18 AC 57 ms
28,160 KB
testcase_19 AC 57 ms
28,160 KB
testcase_20 AC 60 ms
28,160 KB
testcase_21 AC 57 ms
28,160 KB
testcase_22 AC 57 ms
28,160 KB
testcase_23 AC 20 ms
5,376 KB
testcase_24 AC 20 ms
5,376 KB
testcase_25 AC 21 ms
5,376 KB
testcase_26 AC 21 ms
5,376 KB
testcase_27 TLE -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

const int Mod = 924844033;

typedef struct List {
	struct List *next;
	int len;
	long long sum;
} list;

int main()
{
	char S[3000001];
	scanf("%s", S);
	
	int i, j, k = 0, n = 0, A[3000001];
	for (i = 0; S[i] != 0; i = j) {
		for (j = i + 1; S[j] == S[i]; j++);
		if (S[i] == '0') {
			if (n < j - i) n = j - i;
			A[k++] = i - j;
		} else A[k++] = j - i;
	}
	
	int m = 0;
	long long ans = 1, zero_lr = 1, tmp;
	list head, tail, d[3000001], *p;
	head.len = 0;
	tail.len = n + 1;
	tail.sum = 0;
	head.next = &tail;
	tail.next = NULL;
	if (A[k-1] < 0) zero_lr = -A[--k] + 1;
	if (k > 0) {
		if (A[0] < 0) zero_lr = zero_lr * (-A[0] + 1) % Mod;
		ans = A[k-1];
		for (i = k - 3, j = k - 2; i >= 0; i -= 2, j -= 2) {
			for (p = &head; p->next->len <= -A[j]; p = p->next);
			d[m].len = -A[j];
			d[m].sum = ans;
			d[m].next = p->next;
			head.next = &(d[m++]);
			for (p = &head, tmp = 0; p->next->len <= n; p = p->next) tmp += p->next->sum * (p->next->len - p->len) % Mod;
			ans += (tmp % Mod + 1) * A[i] % Mod;
			if (ans >= Mod) ans -= Mod;
		}
	} else zero_lr--;
	printf("%lld\n", ans * zero_lr % Mod);
	fflush(stdout);
	return 0;
}
0