結果
| 問題 |
No.1608 Yet Another Ants Problem
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-07-16 22:42:10 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,061 bytes |
| コンパイル時間 | 705 ms |
| コンパイル使用メモリ | 67,572 KB |
| 実行使用メモリ | 74,224 KB |
| 最終ジャッジ日時 | 2024-07-06 10:12:57 |
| 合計ジャッジ時間 | 4,452 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 29 WA * 3 |
ソースコード
#include <iostream>
#include <algorithm>
using namespace std;
int a[3009];
long long cb[3009][3009], ans[3009], md = 998244353;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int n, l; cin >> n >> l;
cb[0][0] = 1;
for (int i = 1; i <= n; i++) {
cin >> a[i];
cb[i][0] = 1;
for (int j = 1; j <= n; j++)
cb[i][j] = (cb[i - 1][j - 1] + cb[i - 1][j]) % md;
}
for (int i = 1; i <= n; i++) {
for (int pi = 0; pi < 2; pi++) {
int c = n - 1, lc = 0, rc = 0, h = a[i];
if (pi) h = l - a[i];
bool f = true;
for (int j = 1; j <= n; j++) {
if (i == j) continue;
bool lf = (a[j] <= h), rf = ((l - a[j]) <= h);
if (j > i) {
if (a[j] == h) lf = false;
if (l - a[j] == h) rf = false;
}
if (!lf && !rf) {
f = false;
break;
}
else if (!lf || !rf) {
c--;
if (!lf) rc++;
else lc++;
}
}
if (!f) continue;
for (int j = 0; j <= c; j++)
ans[lc + j + 1] = (ans[lc + j + 1] + cb[c][j]) % md;
}
}
for (int i = 1; i <= n; i++)
cout << ans[i] << '\n';
return 0;
}