Submission #20824

# Submission time Handle Problem Language Result Execution time Memory
20824 2017-02-20T13:30:55 Z model_code None (KOI16_gasM) C++11
100 / 100
29 ms 1896 KB
#include<stdio.h>
int n;
int dist[100100];
int cost[100100];
long long int ans;
long long int mc;
int main() {
int i;
scanf("%d", &n);
for (i = 0; i < n - 1; i++) {
scanf("%d", &dist[i]);
}
for (i = 0; i < n; i++) {
scanf("%d", &cost[i]);
}
ans = 0;
mc = cost[0];
for (i = 0; i < n-1; i++) {
if (mc > cost[i])mc = cost[i];
ans += mc*dist[i];
}
printf("%lld", ans);
return 0;
}

Compilation message

gas.cpp: In function 'int main()':
gas.cpp:9:16: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
 scanf("%d", &n);
                ^
gas.cpp:11:22: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
 scanf("%d", &dist[i]);
                      ^
gas.cpp:14:22: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
 scanf("%d", &cost[i]);
                      ^
# Verdict Execution time Memory Grader output
1 Correct 16 ms 1896 KB Output is correct
2 Correct 16 ms 1896 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1896 KB Output is correct
2 Correct 0 ms 1896 KB Output is correct
3 Correct 0 ms 1896 KB Output is correct
4 Correct 0 ms 1896 KB Output is correct
5 Correct 0 ms 1896 KB Output is correct
6 Correct 0 ms 1896 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 16 ms 1896 KB Output is correct
2 Correct 16 ms 1896 KB Output is correct
3 Correct 0 ms 1896 KB Output is correct
4 Correct 0 ms 1896 KB Output is correct
5 Correct 0 ms 1896 KB Output is correct
6 Correct 0 ms 1896 KB Output is correct
7 Correct 0 ms 1896 KB Output is correct
8 Correct 0 ms 1896 KB Output is correct
9 Correct 0 ms 1896 KB Output is correct
10 Correct 0 ms 1896 KB Output is correct
11 Correct 3 ms 1896 KB Output is correct
12 Correct 9 ms 1896 KB Output is correct
13 Correct 29 ms 1896 KB Output is correct
14 Correct 23 ms 1896 KB Output is correct
15 Correct 19 ms 1896 KB Output is correct