Submission #84032

#TimeUsernameProblemLanguageResultExecution timeMemory
84032tjdgus4384주유소 (KOI16_gasM)C++14
100 / 100
35 ms5784 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...