結果
問題 |
No.1172 Add Recursive Sequence
|
ユーザー |
|
提出日時 | 2020-08-14 23:05:30 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 884 bytes |
コンパイル時間 | 4,006 ms |
コンパイル使用メモリ | 216,344 KB |
最終ジャッジ日時 | 2025-01-13 00:39:21 |
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 14 TLE * 2 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:31:42: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘ll’ {aka ‘long long int’} [-Wformat=] 31 | for (int i = 0; i < N; ++i) printf("%d\n", res[i] % MOD); | ~^ ~~~~~~~~~~~~ | | | | int ll {aka long long int} | %lld main.cpp:19:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 19 | scanf("%d%d%d", &K, &N, &M); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~ main.cpp:20:38: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 20 | for (int i = 0; i < K; ++i) scanf("%d", A + i); | ~~~~~^~~~~~~~~~~~~ main.cpp:21:38: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 21 | for (int i = 0; i < K; ++i) scanf("%d", C + i); | ~~~~~^~~~~~~~~~~~~ main.cpp:28:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 28 | scanf("%d%d", &L, &R); | ~~~~~^~~~~~~~~~~~~~~~
ソースコード
#pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx") #include <bits/stdc++.h> using namespace std; using ll = long long; using ui128 = __uint128_t; constexpr int MOD = (int)1e9 + 7; constexpr int MX = 100000; constexpr int MX_K = 200; int K, N, M, L, R; int A[MX + 1], C[MX_K + 1]; ll res[MX + 1]; ui128 tmp; int main() { scanf("%d%d%d", &K, &N, &M); for (int i = 0; i < K; ++i) scanf("%d", A + i); for (int i = 0; i < K; ++i) scanf("%d", C + i); for (int i = K; i < N; ++i) { tmp = 0; for (int j = 0; j < K; ++j) tmp += ll(C[j]) * A[i - 1 - j]; A[i] = tmp % MOD; } for (int i = 0; i < M; ++i) { scanf("%d%d", &L, &R); for (int j = L; j < R; ++j) res[j] += A[j - L]; } for (int i = 0; i < N; ++i) printf("%d\n", res[i] % MOD); }