Submission #3120219
Source Code Expand
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <fstream>
#include <queue>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <sstream>
#define For(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) For(i,0,n)
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
#define SORT(c) sort((c).begin(),(c).end())
#define vi(m,a) vector<int> m(a)
#define vti(m,a,i) vector<vector<int>> m(a,vector<int>(i))
#define ALL(it,a) for(auto it = a.begin(); it!=a.end(); it++)
#define Fe(it,a) for(auto &it : a)
#define all(a) begin(a),end(a)
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
#define WARU 1000000007;
int dx[] = { 1,0,-1,0 };
int dy[] = { 0,1,0,-1 };
void printhoge(set<int> v) {
ALL(it, v) {
cout << *it << " ";
}
cout << endl;
}
ll v[4005][4005];
void comb() {
rep(i,4005){
v[i][0] = 1;
v[i][i] = 1;
}
rep(k,4005){
For(j,1,k){
v[k][j] = (v[k - 1][j - 1] + v[k - 1][j]) % 998244353;
}
}
}
ll h(int a, int b) {
ll c = a + b - 1;
return v[c][b];
}
int main() {
int k, n;
cin >> k >> n;
comb();
vector<ll> kosuu(4005);
For(i, 1, k + 1) {
For(m, i, k + 1) {
kosuu[i + m]++;
}
}
ll goukei = h(k, n);
For(i, 2, 2 * k + 1) {
ll result = goukei;
result -= h(k, n - 2) * kosuu[i];
ll tmp = n - 2;
ll kos = kosuu[i];
ll kosv = 1;
while (tmp > 0 && kos > 1 && kosv!= kosuu[i]) {
tmp -= 2;
kos--;
kosv++;
result += h(k, tmp) * (v[kosuu[i]][kosv]);
}
if (result < 0) {
while (result < 0) {
result += 998244353;
}
}
cout << result % 998244353 << endl;
}
}
Submission Info
| Submission Time |
|
| Task |
E - Stop. Otherwise... |
| User |
admjgptw1357 |
| Language |
C++14 (Clang 3.8.0) |
| Score |
0 |
| Code Size |
1814 Byte |
| Status |
WA |
| Exec Time |
51 ms |
| Memory |
123904 KiB |
Judge Result
| Set Name |
Sample |
All |
| Score / Max Score |
0 / 0 |
0 / 700 |
| Status |
|
|
| Set Name |
Test Cases |
| Sample |
s1.txt, s2.txt, s3.txt |
| All |
01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, s1.txt, s2.txt, s3.txt |
| Case Name |
Status |
Exec Time |
Memory |
| 01.txt |
WA |
51 ms |
123904 KiB |
| 02.txt |
WA |
50 ms |
123904 KiB |
| 03.txt |
WA |
51 ms |
123904 KiB |
| 04.txt |
AC |
38 ms |
123904 KiB |
| 05.txt |
AC |
46 ms |
123904 KiB |
| 06.txt |
WA |
49 ms |
123904 KiB |
| 07.txt |
WA |
51 ms |
123904 KiB |
| 08.txt |
WA |
41 ms |
123904 KiB |
| 09.txt |
WA |
37 ms |
123904 KiB |
| 10.txt |
WA |
44 ms |
123904 KiB |
| 11.txt |
AC |
45 ms |
123904 KiB |
| 12.txt |
AC |
37 ms |
123904 KiB |
| 13.txt |
WA |
41 ms |
123904 KiB |
| 14.txt |
WA |
50 ms |
123904 KiB |
| 15.txt |
WA |
50 ms |
123904 KiB |
| 16.txt |
WA |
49 ms |
123904 KiB |
| 17.txt |
AC |
37 ms |
123904 KiB |
| 18.txt |
AC |
37 ms |
123904 KiB |
| 19.txt |
AC |
37 ms |
123904 KiB |
| 20.txt |
AC |
37 ms |
123904 KiB |
| s1.txt |
AC |
38 ms |
123904 KiB |
| s2.txt |
AC |
37 ms |
123904 KiB |
| s3.txt |
WA |
38 ms |
123904 KiB |