結果
| 問題 | No.1068 #いろいろな色 / Red and Blue and more various colors (Hard) |
| コンテスト | |
| ユーザー |
keijak
|
| 提出日時 | 2022-01-01 17:04:50 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 330 ms / 3,500 ms |
| コード長 | 609 bytes |
| コンパイル時間 | 4,884 ms |
| コンパイル使用メモリ | 263,172 KB |
| 最終ジャッジ日時 | 2025-01-27 08:20:37 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
8 | scanf("%d%d",&N,&Q);
| ~~~~~^~~~~~~~~~~~~~
main.cpp:12:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
12 | scanf("%lld",&a);
| ~~~~~^~~~~~~~~~~
main.cpp:23:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
23 | scanf("%d", &b);
| ~~~~~^~~~~~~~~~
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using Mint = atcoder::modint998244353;
int main() {
int N, Q;
scanf("%d%d",&N,&Q);
deque<vector<Mint>> q;
for (int i = 0; i < N; ++i) {
long long a;
scanf("%lld",&a);
q.push_back(vector<Mint>{a-1,1});
}
while (q.size() > 1) {
auto r = atcoder::convolution(q[0],q[1]);
if (r.size() > N+1) r.resize(N+1);
q.pop_front();q.pop_front();
q.push_back(r);
}
const auto &f = q.front();
for (int i = 0, b; i < Q; ++i) {
scanf("%d", &b);
printf("%u\n", f[b].val());
}
}
keijak