summaryrefslogtreecommitdiffstats
path: root/šola/p2/dn/DN09b_63230317.c
blob: daca2bf03af3a40ccef9942ac7746ba6c79201fc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
int next (bool * s, int l) {
	bool hit0 = false;
	bool hit1after0 = false;
	int end1count = 0;
	int end1 = l-1;
	for (int i = l-1; i >= 0; i--) {
		if (!s[end1])
			end1--;
		if (!hit0 && s[i] == 1)
			end1count++;
		if (!s[i])
			hit0 = true;
		if (hit0 && s[i])
			hit1after0 = true;
	}
	if (end1 == -1) { // prazen vhod, sedaj 1 bit
		for (int i = 0; i < l; i++)
			s[i] = false;
		s[0] = true;
		return 1;
	}
	if (!hit0)
		return len+1; // konec
	if (!hif1after0) { // inc št enic
		for (int i = 0; i < l; i++) {
			s[i] = false;
			if (i < end1count)
				s[i] = true;
		}
		return end1count;
	}
}
int main (void) {
	int s, g, m;
	scanf("%d", &s);
	char * i[s];
	char * r[s];
	for (int i = 0; i < s; i++)
		scanf("%ms %ms", &i[s], &r[s]);
	scanf("%d", &g);
	char * gl[g];
	for (int i = 0; i < s; i++)
		scanf("%ms", &gl[s]);
	bool samost[s];
}