Submission #84031

# Submission time Handle Problem Language Result Execution time Memory
84031 2018-11-12T12:53:06 Z tjdgus4384 None (KOI16_gasM) C++14
58 / 100
24 ms 1140 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 += 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 24 ms 1016 KB Output is correct
2 Correct 23 ms 1140 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1140 KB Output is correct
2 Correct 2 ms 1140 KB Output is correct
3 Correct 2 ms 1140 KB Output is correct
4 Correct 2 ms 1140 KB Output is correct
5 Correct 3 ms 1140 KB Output is correct
6 Correct 2 ms 1140 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 24 ms 1016 KB Output is correct
2 Correct 23 ms 1140 KB Output is correct
3 Correct 2 ms 1140 KB Output is correct
4 Correct 2 ms 1140 KB Output is correct
5 Correct 2 ms 1140 KB Output is correct
6 Correct 2 ms 1140 KB Output is correct
7 Correct 3 ms 1140 KB Output is correct
8 Correct 2 ms 1140 KB Output is correct
9 Incorrect 2 ms 1140 KB Output isn't correct
10 Halted 0 ms 0 KB -