Submission #65536918


Source Code Expand

Copy
#include <stdio.h>
#include <inttypes.h>
int N;
int A[3123];
uint64_t sum[3123];
int main(void) {
int i, k;
if (scanf("%d", &N) != 1) return 1;
for (i = 1; i <= N; i++) {
if (scanf("%d", &A[i]) != 1) return 1;
sum[i] = sum[i - 1] + A[i];
}
for (k = 1; k <= N; k++) {
uint64_t ans = 0;
for (i = k; i <= N; i++) {
uint64_t candidate = sum[i] - sum[i - k];
if (candidate > ans) ans= candidate;
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include <stdio.h>
#include <inttypes.h>

int N;
int A[3123];

uint64_t sum[3123];

int main(void) {
	int i, k;
	if (scanf("%d", &N) != 1) return 1;
	for (i = 1; i <= N; i++) {
		if (scanf("%d", &A[i]) != 1) return 1;
		sum[i] = sum[i - 1] + A[i];
	}
	for (k = 1; k <= N; k++) {
		uint64_t ans = 0;
		for (i = k; i <= N; i++) {
			uint64_t candidate = sum[i] - sum[i - k];
			if (candidate > ans) ans= candidate;
		}
		printf("%" PRIu64 "\n", ans);
	}
	return 0;
}

Submission Info

Submission Time
Task A - Abundant Resources
User mikecat
Language C (gcc 12.2.0)
Score 200
Code Size 490 Byte
Status AC
Exec Time 4 ms
Memory 1760 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 13
Set Name Test Cases
Sample sample-01.txt, sample-02.txt, sample-03.txt
All 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, sample-01.txt, sample-02.txt, sample-03.txt
Case Name Status Exec Time Memory
01-01.txt AC 1 ms 1704 KB
01-02.txt AC 1 ms 1728 KB
01-03.txt AC 1 ms 1712 KB
01-04.txt AC 2 ms 1664 KB
01-05.txt AC 2 ms 1636 KB
01-06.txt AC 2 ms 1760 KB
01-07.txt AC 3 ms 1660 KB
01-08.txt AC 4 ms 1748 KB
01-09.txt AC 4 ms 1748 KB
01-10.txt AC 4 ms 1628 KB
sample-01.txt AC 1 ms 1732 KB
sample-02.txt AC 1 ms 1616 KB
sample-03.txt AC 0 ms 1712 KB


2025-05-06 (Tue)
07:35:41 +09:00