Submission #441662

# Submission time Handle Problem Language Result Execution time Memory
441662 2021-07-05T17:44:19 Z rainboy Nizin (COCI16_nizin) C
100 / 100
120 ms 6188 KB
#include <stdio.h>

#define N	1000000

int main() {
	static int aa[N];
	int n, i, j, k, sum;

	scanf("%d", &n);
	for (i = 0; i < n; i++)
		scanf("%d", &aa[i]);
	i = 0, j = n - 1, k = 0, sum = 0;
	while (i <= j) {
		if (sum > 0)
			sum -= aa[i++];
		else
			sum += aa[j--];
		if (sum == 0)
			k += 2;
	}
	if (sum != 0)
		k++;
	printf("%d\n", n - k);
	return 0;
}

Compilation message

nizin.c: In function 'main':
nizin.c:9:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |  scanf("%d", &n);
      |  ^~~~~~~~~~~~~~~
nizin.c:11:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |   scanf("%d", &aa[i]);
      |   ^~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 288 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 284 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 668 KB Output is correct
2 Correct 10 ms 800 KB Output is correct
3 Correct 11 ms 864 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 50 ms 2316 KB Output is correct
2 Correct 46 ms 2840 KB Output is correct
3 Correct 52 ms 3176 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 79 ms 4672 KB Output is correct
2 Correct 83 ms 4932 KB Output is correct
3 Correct 96 ms 5564 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 110 ms 6080 KB Output is correct
2 Correct 116 ms 6160 KB Output is correct
3 Correct 120 ms 6188 KB Output is correct