結果
| 問題 |
No.754 畳み込みの和
|
| コンテスト | |
| ユーザー |
3_3_nk
|
| 提出日時 | 2020-09-11 10:30:03 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,490 bytes |
| コンパイル時間 | 2,520 ms |
| コンパイル使用メモリ | 169,496 KB |
| 実行使用メモリ | 17,152 KB |
| 最終ジャッジ日時 | 2024-12-25 13:21:25 |
| 合計ジャッジ時間 | 26,641 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | TLE * 3 |
ソースコード
#include <bits/stdc++.h>
#define PREP(i, s, x) for(ll i = (s); i < (x); i++)
#define MREP(i, s, x) for(ll i = (s); i >= (x); i--)
#define REP(i, x) PREP(i, 0, x)
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
template<typename T> inline bool chmax(T &a, T b) { return ((a < b) ? (a = b, true) : (false)); }
template<typename T> inline bool chmin(T &a, T b) { return ((a > b) ? (a = b, true) : (false)); }
// variable -------------------------------------------
constexpr ll INF = (1ll << 59);
constexpr ll MOD = 1000000007ll;
// structure ------------------------------------------
// function -------------------------------------------
void print(vector<ll> a, vector<ll> b){
cout << "(";
REP(i, a.size()){
if(i != 0){
cout << " + ";
}
cout << a[i];
if(i != 0){
cout << "x";
if(i >= 2){
cout << "^" << i;
}
}
}
cout << ")(";
REP(i, b.size()){
if(i != 0){
cout << " + ";
}
cout << b[i];
if(i != 0){
cout << "x";
if(i >= 2){
cout << "^" << i;
}
}
}
cout << ")" << endl;
return;
}
// main -----------------------------------------------
int main() {
ll n;
cin >> n;
vector<ll> a(n+1), b(n+1);
REP(i, n+1){
cin >> a[i];
}
REP(i, n+1){
cin >> b[i];
}
// print(a, b);
vector<ll> c(2*n+1);
REP(i, n+1){
REP(j, n+1){
c[i+j] += a[i]*b[j]%MOD;
c[i+j] %= MOD;
}
}
ll sum = 0;
REP(i, n+1){
sum += c[i];
sum %= MOD;
// cout << c[i] << endl;
}
cout << sum << endl;
return 0;
}
3_3_nk