제출 #1289439

#제출 시각아이디문제언어결과실행 시간메모리
1289439LIAFancy Fence (CEOI20_fancyfence)C++17
0 / 100
1096 ms572 KiB
//
// Created by liasa on 10/11/2025.
//

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vll vector<ll>
const ll mod = 1e9 + 6;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ll n;
  cin >> n;
  vll h(n), w(n);
  ll H = 0, W = 0;
  for (ll i = 0; i < n; ++i)
    cin >> h[i];
  for (ll i = 0; i < n; ++i)
    cin >> w[i];
  for (ll i = 0; i < n; ++i) {
    H = max(H, h[i]);
    W += w[i];
  }

  H++, W++;
  ll ans = 0;
  for (ll x1 = 0; x1 < H; x1++) {
    for (ll x2 = x1 + 1; x2 < H; x2++) {
      for (ll y1 = 0; y1 < W; y1++) {
        for (ll y2 = y1 + 1; y2 < W; y2++) {
          // cout << x1 << " " << y1 << " " << x2 << " " << y2 << endl;
          ans++;
          ans%=mod;
        }
      }
    }
  }
  // ll ans = (H * (H - 1) / 2) % mod;
  // ans = (ans * W * (W - 1) / 2) % mod;
  cout << ans;
}
#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...