Submission #534864

#TimeUsernameProblemLanguageResultExecution timeMemory
534864mjhmjh1104Fancy Fence (CEOI20_fancyfence)C++17
30 / 100
9 ms4224 KiB
#include <cstdio> #include <algorithm> using namespace std; const int MOD = 1e9 + 7; int n, h[1006], w[1006], res, a[1006][1006]; int main() { scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", h + i); for (int i = 0; i < n; i++) scanf("%d", w + i); for (int i = 0; i < n; i++) res = (res + 1LL * (1LL * w[i] * (w[i] + 1) / 2 % MOD) * (1LL * h[i] * (h[i] + 1) / 2 % MOD) % MOD) % MOD; for (int i = 0; i < n; i++) { a[i][i] = h[i]; for (int j = i + 1; j < n; j++) a[i][j] = min(h[j], a[i][j - 1]); } for (int i = 0; i < n; i++) for (int j = i + 1; j < n; j++) res = (res + 1LL * w[i] * w[j] % MOD * (1LL * a[i][j] * (a[i][j] + 1) / 2 % MOD) % MOD) % MOD; printf("%d", res); }

Compilation message (stderr)

fancyfence.cpp: In function 'int main()':
fancyfence.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
fancyfence.cpp:11:38: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     for (int i = 0; i < n; i++) scanf("%d", h + i);
      |                                 ~~~~~^~~~~~~~~~~~~
fancyfence.cpp:12:38: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |     for (int i = 0; i < n; i++) scanf("%d", w + i);
      |                                 ~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...