Submission #84032

# Submission time Handle Problem Language Result Execution time Memory
84032 2018-11-12T12:54:32 Z tjdgus4384 None (KOI16_gasM) C++14
100 / 100
35 ms 5784 KB
#include<cstdio>
int d[100001], m[100001];

int main()
{
    int n, s = 1000000000;
    scanf("%d", &n);
    for(int i = 1;i < n;i++)
    {
        scanf("%d", &d[i]);
    }
    for(int i = 0;i < n;i++)
    {
        scanf("%d", &m[i]);
    }
    long long ans = 0;
    for(int i = 0;i < n;i++)
    {
        if(m[i] < s) s = m[i];
        ans += (long long)s * d[i + 1];
    }
    printf("%lld", ans);
    return 0;
}

Compilation message

gas.cpp: In function 'int main()':
gas.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
gas.cpp:10:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &d[i]);
         ~~~~~^~~~~~~~~~~~~
gas.cpp:14:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &m[i]);
         ~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 27 ms 1116 KB Output is correct
2 Correct 21 ms 1128 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1128 KB Output is correct
2 Correct 2 ms 1128 KB Output is correct
3 Correct 2 ms 1128 KB Output is correct
4 Correct 2 ms 1128 KB Output is correct
5 Correct 2 ms 1128 KB Output is correct
6 Correct 2 ms 1128 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 27 ms 1116 KB Output is correct
2 Correct 21 ms 1128 KB Output is correct
3 Correct 2 ms 1128 KB Output is correct
4 Correct 2 ms 1128 KB Output is correct
5 Correct 2 ms 1128 KB Output is correct
6 Correct 2 ms 1128 KB Output is correct
7 Correct 2 ms 1128 KB Output is correct
8 Correct 2 ms 1128 KB Output is correct
9 Correct 2 ms 1128 KB Output is correct
10 Correct 3 ms 1128 KB Output is correct
11 Correct 6 ms 1128 KB Output is correct
12 Correct 12 ms 1504 KB Output is correct
13 Correct 35 ms 3560 KB Output is correct
14 Correct 32 ms 5088 KB Output is correct
15 Correct 27 ms 5784 KB Output is correct