답안 #788130

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
788130 2023-07-19T19:48:46 Z rainboy Fruits (NOI22_fruits) C
5 / 100
93 ms 17840 KB
#include <stdio.h>

#define N	400000

int main() {
	static int aa[N], cc[N];
	static long long ss[N + 1];
	static char used[N];
	static int kk[N], xx[N], yy[N];
	int n, k, i, l, a;

	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d", &aa[i]), aa[i]--;
		if (aa[i] >= 0)
			used[aa[i]] = 1;
	}
	for (a = 0; a < n; a++)
		scanf("%d", &cc[a]);
	k = 0;
	for (a = 0; a < n; a++) {
		kk[a] = k;
		if (!used[a])
			ss[k + 1] = ss[k] + cc[a], k++;
	}
	for (k = 1; k <= n; k++)
		printf("%lld ", ss[n] - ss[n - k]);
	printf("\n");
	l = 0;
	for (i = 1; i < n; i++)
		if (aa[i] == -2)
			l++;
		else {
			if (a > aa[i])
				aa[i] = -1;
			else {
				xx[i] = kk[aa[i]], yy[i] = xx[i] - l;
				if (yy[i] < 0)
					aa[i] = -1;
			}
		}
	for (i = 0; i < n; i++) {
	}
	return 0;
}

Compilation message

Main.c: In function 'main':
Main.c:12:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |  scanf("%d", &n);
      |  ^~~~~~~~~~~~~~~
Main.c:14:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |   scanf("%d", &aa[i]), aa[i]--;
      |   ^~~~~~~~~~~~~~~~~~~
Main.c:19:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |   scanf("%d", &cc[a]);
      |   ^~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 300 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 5 ms 1088 KB Output is correct
4 Correct 46 ms 9252 KB Output is correct
5 Correct 93 ms 17840 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 300 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 300 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 87 ms 12732 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 300 KB Output isn't correct
2 Halted 0 ms 0 KB -