Submission #745319

#TimeUsernameProblemLanguageResultExecution timeMemory
745319rainboyExam (eJOI20_exam)C11
12 / 100
28 ms3072 KiB
#include <stdio.h>

#define N	100000

int max(int a, int b) { return a > b ? a : b; }

int main() {
	static int aa[N], bb[N];
	int n, same, i, j, b, k, good;

	scanf("%d", &n);
	for (i = 0; i < n; i++)
		scanf("%d", &aa[i]);
	for (i = 0; i < n; i++)
		scanf("%d", &bb[i]);
	same = 1;
	for (i = 1; i < n; i++)
		if (bb[i] != bb[i - 1]) {
			same = 0;
			break;
		}
	if (same) {
		b = bb[0], k = 0;
		for (i = 0; i < n; i++)
			if (aa[i] <= b) {
				j = i;
				good = 0;
				while (j < n && aa[j] <= b)
					if (aa[j++] == b)
						good = 1;
				if (good)
					k += j - i;
				i = j;
			}
		printf("%d\n", k);
	}
	return 0;
}

Compilation message (stderr)

exam.c: In function 'main':
exam.c:11:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |  scanf("%d", &n);
      |  ^~~~~~~~~~~~~~~
exam.c:13:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |   scanf("%d", &aa[i]);
      |   ^~~~~~~~~~~~~~~~~~~
exam.c:15:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |   scanf("%d", &bb[i]);
      |   ^~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...