Submission #1199544

#TimeUsernameProblemLanguageResultExecution timeMemory
1199544thewizardmanFancy Fence (CEOI20_fancyfence)C++20
0 / 100
5 ms328 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long ll n, h[100001], w[100001], dp[100001], md = 1e9+7, ans; vector<pair<ll, ll>> v; ll bruh(ll a, ll b) { return ((a * b) / 2ll) % md; } int main() { scanf("%lld", &n); for (int i = 0; i < n; i++) scanf("%lld", h+i); for (int i = 0; i < n; i++) scanf("%lld", w+i); for (int i = 0; i < n; i++) { while (!v.empty() && v.back().first > h[i]) v.pop_back(); v.push_back({h[i], w[i]}); ll k = 0, asdf = 0; for (auto it = v.rbegin(); it != v.rend(); it++) { auto [h, w] = *it; ans = (ans + bruh(h+1, h) * bruh(w+k+1, w)) % md; k += w; // cout << k << ' ' << w << ' '; } // ans += asdf; // cout << asdf << '\n'; } printf("%lld", ans); }

Compilation message (stderr)

fancyfence.cpp: In function 'int main()':
fancyfence.cpp:13:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |   scanf("%lld", &n);
      |   ~~~~~^~~~~~~~~~~~
fancyfence.cpp:14:36: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |   for (int i = 0; i < n; i++) scanf("%lld", h+i);
      |                               ~~~~~^~~~~~~~~~~~~
fancyfence.cpp:15:36: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |   for (int i = 0; i < n; i++) scanf("%lld", 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...