結果
| 問題 | No.754 畳み込みの和 | 
| コンテスト | |
| ユーザー |  nasadigital | 
| 提出日時 | 2018-12-02 01:44:28 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 27 ms / 5,000 ms | 
| コード長 | 1,252 bytes | 
| コンパイル時間 | 887 ms | 
| コンパイル使用メモリ | 110,528 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-06-27 06:01:59 | 
| 合計ジャッジ時間 | 1,451 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 3 | 
ソースコード
#include <algorithm>
#include <chrono>
#include <cstring>
#include <iomanip>
#include <istream>
#include <map>
#include <numeric>
#include <ostream>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define MOD 1000000007
using namespace std;
typedef long long ll;
class Solution {
 public:
  void solve(std::istream& in, std::ostream& out) {
    int n;
    in >> n;
    ++n;
    int a[n], b[n];
    for (int ctr1 = 0; ctr1 < n; ++ctr1)
      in >> a[ctr1];
    for (int ctr1 = 0; ctr1 < n; ++ctr1)
      in >> b[ctr1];
    ll total = accumulate(a, a + n, 0LL) % MOD;
    ll rez = 0;
    for (int ctr1 = 0; ctr1 < n; ++ctr1)
      rez = (rez + total * b[ctr1]) % MOD, total = (total - a[n - ctr1 - 1] + MOD) % MOD;
    out << rez << "\n";
  }
};
void solve(std::istream& in, std::ostream& out)
{
  out << std::setprecision(12);
  Solution solution;
  solution.solve(in, out);
}
// Powered by caide (code generator, tester, and library code inliner)
#include <fstream>
#include <iostream>
int main() {
  
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  istream& in = cin;
  ostream& out = cout;
  solve(in, out);
  return 0;
}
            
            
            
        