Submission #924308

# Submission time Handle Problem Language Result Execution time Memory
924308 2024-02-08T20:12:33 Z rainboy None (KOI16_gasM) C
100 / 100
17 ms 2228 KB
#include <stdio.h>

#define N	100000
#define INF	0x3f3f3f3f

int min(int a, int b) { return a < b ? a : b; }

int main() {
	static int dd[N];
	int n, i, c, c_;
	long long ans;

	scanf("%d", &n);
	for (i = 0; i + 1 < n; i++)
		scanf("%d", &dd[i]);
	c_ = INF, ans = 0;
	for (i = 0; i + 1 < n; i++) {
		scanf("%d", &c);
		c_ = min(c_, c);
		ans += (long long) c_ * dd[i];
	}
	printf("%lld\n", ans);
	return 0;
}

Compilation message

gas.c: In function 'main':
gas.c:13:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |  scanf("%d", &n);
      |  ^~~~~~~~~~~~~~~
gas.c:15:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |   scanf("%d", &dd[i]);
      |   ^~~~~~~~~~~~~~~~~~~
gas.c:18:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |   scanf("%d", &c);
      |   ^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 17 ms 1116 KB Output is correct
2 Correct 11 ms 1116 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 17 ms 1116 KB Output is correct
2 Correct 11 ms 1116 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 2 ms 348 KB Output is correct
12 Correct 5 ms 860 KB Output is correct
13 Correct 15 ms 2228 KB Output is correct
14 Correct 15 ms 1876 KB Output is correct
15 Correct 14 ms 1352 KB Output is correct