summaryrefslogtreecommitdiffstats
path: root/inf/zotksd/1
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xinf/zotksd/1bin0 -> 282656 bytes
-rw-r--r--inf/zotksd/1.c57
-rw-r--r--inf/zotksd/1.txt8
-rw-r--r--inf/zotksd/1.txt28
4 files changed, 73 insertions, 0 deletions
diff --git a/inf/zotksd/1 b/inf/zotksd/1
new file mode 100755
index 0000000..a11970d
--- /dev/null
+++ b/inf/zotksd/1
Binary files differ
diff --git a/inf/zotksd/1.c b/inf/zotksd/1.c
new file mode 100644
index 0000000..7a2de18
--- /dev/null
+++ b/inf/zotksd/1.c
@@ -0,0 +1,57 @@
+// naloge ne razumem najbolje
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#define S 25000
+int main (void) {
+ int crke[25];
+ char buf[S];
+ fgets(buf, S, stdin);
+ int n = strtol(buf, NULL, 10);
+ for (int i = 0; i < n; i++) {
+ int crkecopy[25];
+ memcpy(crkecopy, crke, sizeof(crke));
+ fgets(buf, S, stdin);
+ char dodaten = -1;
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wsign-compare"
+ if (strlen(buf) != i+1 && 0) {
+#ifndef EVAL
+ fprintf(stderr, "napačna dolžina niza %s na indeksu %d\n", buf, i);
+#endif
+ printf("%d\n", i);
+ return 0;
+ }
+#pragma GCC diagnostic pop
+#ifndef EVAL
+ fprintf(stderr, "pri i==%d obdelujem niz %s", i, buf);
+#endif
+ for (int j = 0; j <= i; j++) {
+ int crka = buf[j]-'A';
+ if (--crkecopy[crka] < 0) {
+ if (dodaten != -1) {
+ printf("%d\n", i);
+#ifndef EVAL
+ fprintf(stderr, "konec, ker je preveč novih, dodaten je %c\n", dodaten+'A');
+#endif
+ return 0;
+ }
+ dodaten = crka;
+#ifndef EVAL
+ fprintf(stderr, "i==%d, dodaten je sedaj %c\n", i, dodaten+'A');
+#endif
+ crke[crka]++;
+ }
+ }
+ for (int j = 0; j < 25; j++)
+ if (crkecopy[j] != 0 && crkecopy[j] != -1) {
+ printf("%d\n", i);
+#ifndef EVAL
+ fprintf(stderr, "konec, ker ni pobrisal vseh\n");
+#endif
+ return 0;
+ }
+ }
+ printf("%d\n", n);
+ return 0;
+}
diff --git a/inf/zotksd/1.txt b/inf/zotksd/1.txt
new file mode 100644
index 0000000..9820f10
--- /dev/null
+++ b/inf/zotksd/1.txt
@@ -0,0 +1,8 @@
+7
+R
+AR
+RAK
+TRAK
+KARTA
+RAKETA
+TRAKTOR
diff --git a/inf/zotksd/1.txt2 b/inf/zotksd/1.txt2
new file mode 100644
index 0000000..334d077
--- /dev/null
+++ b/inf/zotksd/1.txt2
@@ -0,0 +1,8 @@
+7
+R
+AR
+RAK
+TRAK
+KARTA
+RAKETAx
+TRAKTOR