Submission #486425

#TimeUsernameProblemLanguageResultExecution timeMemory
486425rainboyDijamant (COI16_dijament)C11
27 / 100
840 ms404 KiB
#include <stdio.h>
#include <string.h>

#define N	1000

char ss[N][16]; int n;

int idx(char *s) {
	int i;

	for (i = 0; i < n; i++)
		if (strcmp(ss[i], s) == 0)
			return i;
	return -1;
}

void add(char *s) {
	strcpy(ss[n++], s);
}

int main() {
	int q;

	scanf("%d", &q);
	while (q--) {
		static char cc[16], pp[16];
		int ok;

		scanf("%s%*s", cc);
		ok = 1;
		while (1) {
			scanf("%s", pp);
			if (pp[0] == ';')
				break;
			if (idx(pp) == -1)
				ok = 0;
		}
		if (idx(cc) != -1)
			ok = 0;
		if (ok) {
			printf("ok\n");
			add(cc);
		} else
			printf("greska\n");
	}
	return 0;
}

Compilation message (stderr)

dijament.c: In function 'main':
dijament.c:24:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |  scanf("%d", &q);
      |  ^~~~~~~~~~~~~~~
dijament.c:29:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   29 |   scanf("%s%*s", cc);
      |   ^~~~~~~~~~~~~~~~~~
dijament.c:32:4: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   32 |    scanf("%s", pp);
      |    ^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...