Submission #54583335
Source Code Expand
Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <fstream>
#include <iomanip>
#include <stack>
#include <cmath>
#include <queue>
#include <assert.h>
#include <climits>
#include <functional>
#include <string>
#include <utility>
#include <unordered_set>
#include <numeric>
#include <random>
#include <complex>
#include <tuple>
#include <array>
#include <bitset>
using namespace std;
typedef vector<int> vi;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, ll> pll;
typedef pair<ll, pii> plp;
typedef pair<pii, int> ppi;
typedef long double ld;
typedef vector<double> vd;
typedef array<int, 4> a4;
const int MOD=998244353;
int ad(int a, int b){
a += b;
if(a >= MOD)a -= MOD;
return a;
}
int sub(int a, int b){
a -= b;
if(a < 0) a += MOD;
return a;
}
int mult(int a, int b){
return (int)((ll)a*b%MOD);
}
int exp(int a, int b){
int res = 1;
while(b){
if(b%2) res = mult(res, a);
a = mult(a, a);
b /= 2;
}
return res;
}
int inv(int a){ return exp(a, MOD-2);}
vector<int> fct;
vector<int> ifct;
int comb(int n, int k){
if(k < 0 || k > n) return 0;
return mult(fct[n], mult(ifct[k], ifct[n-k]));
}
int main(){
fct = vector<int>(1001);
ifct = vector<int>(1001);
fct[0] = 1;
for(int i = 1; i <= 1000; i++){
fct[i] = mult(fct[i-1], i);
}
ifct[1000] = inv(fct[1000]);
for(int i = 1000; i >= 1; i--){
ifct[i-1] = mult(ifct[i], i);
}
cin.tie(0)->sync_with_stdio(0);
int K;
cin >> K;
vector<int> dp(K+1, 0);
dp[0] = 1;
for(int i = 0; i < 26; i++){
vector<int> tdp(K+1, 0);
int C;
cin >> C;
int run = 1;
tdp[0] = 1;
for(int e = 1; e <= K; e++){
for(int j = max(0, e-C); j <= e; j++){
tdp[e] = ad(tdp[e], mult(dp[j], comb(e, j)));
}
}
dp = tdp;
//cout << dp[0] << " " << dp[1] << " " << dp[2] << endl;
}
int res = 0;
for(int i = 1; i <= K; i++) res = ad(res, dp[i]);
cout << res << endl;
return 0;
}
Submission Info
Submission Time |
|
Task |
E - Alphabet Tiles |
User |
surajchips |
Language |
C++ 20 (gcc 12.2) |
Score |
475 |
Code Size |
2316 Byte |
Status |
AC |
Exec Time |
54 ms |
Memory |
3636 KB |
Compile Error
Main.cpp: In function ‘int main()’:
Main.cpp:95:13: warning: unused variable ‘run’ [-Wunused-variable]
95 | int run = 1;
| ^~~
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
475 / 475 |
Status |
|
|
Set Name |
Test Cases |
Sample |
sample00.txt, sample01.txt, sample02.txt |
All |
sample00.txt, sample01.txt, sample02.txt, testcase00.txt, testcase01.txt, testcase02.txt, testcase03.txt, testcase04.txt, testcase05.txt, testcase06.txt, testcase07.txt, testcase08.txt, testcase09.txt, testcase10.txt, testcase11.txt, testcase12.txt, testcase13.txt, testcase14.txt, testcase15.txt, testcase16.txt, testcase17.txt, testcase18.txt |
Case Name |
Status |
Exec Time |
Memory |
sample00.txt |
AC |
1 ms |
3496 KB |
sample01.txt |
AC |
1 ms |
3440 KB |
sample02.txt |
AC |
54 ms |
3636 KB |
testcase00.txt |
AC |
1 ms |
3572 KB |
testcase01.txt |
AC |
1 ms |
3512 KB |
testcase02.txt |
AC |
1 ms |
3508 KB |
testcase03.txt |
AC |
3 ms |
3428 KB |
testcase04.txt |
AC |
7 ms |
3512 KB |
testcase05.txt |
AC |
2 ms |
3496 KB |
testcase06.txt |
AC |
36 ms |
3500 KB |
testcase07.txt |
AC |
16 ms |
3516 KB |
testcase08.txt |
AC |
13 ms |
3472 KB |
testcase09.txt |
AC |
1 ms |
3448 KB |
testcase10.txt |
AC |
32 ms |
3500 KB |
testcase11.txt |
AC |
23 ms |
3580 KB |
testcase12.txt |
AC |
5 ms |
3572 KB |
testcase13.txt |
AC |
1 ms |
3500 KB |
testcase14.txt |
AC |
20 ms |
3572 KB |
testcase15.txt |
AC |
4 ms |
3512 KB |
testcase16.txt |
AC |
27 ms |
3500 KB |
testcase17.txt |
AC |
1 ms |
3512 KB |
testcase18.txt |
AC |
1 ms |
3636 KB |