QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#253007 | #3164. All Kill | Crysfly | AC ✓ | 2ms | 4076kb | C++17 | 2.4kb | 2023-11-16 16:31:47 | 2023-11-16 16:31:49 |
Judging History
answer
// what is matter? never mind.
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,sse4,popcnt,abm,mmx,avx,avx2")
#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(int i=(a);i>=(b);--i)
#define ll long long
#define ull unsigned long long
using namespace std;
inline int read()
{
char c=getchar();int x=0;bool f=0;
for(;!isdigit(c);c=getchar())f^=!(c^45);
for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
if(f)x=-x;return x;
}
#define mod 998244353
struct modint{
int x;
modint(int o=0){x=o;}
modint &operator = (int o){return x=o,*this;}
modint &operator +=(modint o){return x=x+o.x>=mod?x+o.x-mod:x+o.x,*this;}
modint &operator -=(modint o){return x=x-o.x<0?x-o.x+mod:x-o.x,*this;}
modint &operator *=(modint o){return x=1ll*x*o.x%mod,*this;}
modint &operator ^=(int b){
modint a=*this,c=1;
for(;b;b>>=1,a*=a)if(b&1)c*=a;
return x=c.x,*this;
}
modint &operator /=(modint o){return *this *=o^=mod-2;}
friend modint operator +(modint a,modint b){return a+=b;}
friend modint operator -(modint a,modint b){return a-=b;}
friend modint operator *(modint a,modint b){return a*=b;}
friend modint operator /(modint a,modint b){return a/=b;}
friend modint operator ^(modint a,int b){return a^=b;}
friend bool operator ==(modint a,int b){return a.x==b;}
friend bool operator !=(modint a,int b){return a.x!=b;}
bool operator ! () {return !x;}
modint operator - () {return x?mod-x:0;}
bool operator <(const modint&b)const{return x<b.x;}
};
inline modint qpow(modint x,int y){return x^y;}
vector<modint> fac,ifac,iv;
inline void initC(int n)
{
if(iv.empty())fac=ifac=iv=vector<modint>(2,1);
int m=iv.size(); ++n;
if(m>=n)return;
iv.resize(n),fac.resize(n),ifac.resize(n);
For(i,m,n-1){
iv[i]=iv[mod%i]*(mod-mod/i);
fac[i]=fac[i-1]*i,ifac[i]=ifac[i-1]*iv[i];
}
}
inline modint C(int n,int m){
if(m<0||n<m)return 0;
return initC(n),fac[n]*ifac[m]*ifac[n-m];
}
inline modint sign(int n){return (n&1)?(mod-1):(1);}
#define fi first
#define se second
#define pb push_back
#define mkp make_pair
typedef pair<int,int>pii;
typedef vector<int>vi;
#define maxn 200005
#define inf 0x3f3f3f3f
int n,s,t,a[maxn];
modint res;
signed main()
{
n=read(),t=read();
s=t+1;
For(i,1,n)a[i]=read(),s-=a[i];
res=s;
s+=n;
For(i,1,n-1)s+=a[i]-1,res*=s;
cout<<res.x;
return 0;
}
/*
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3688kb
input:
3 5 1 2 1
output:
60
result:
ok single line: '60'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3536kb
input:
5 5 1 1 1 1 1
output:
1296
result:
ok single line: '1296'
Test #3:
score: 0
Accepted
time: 2ms
memory: 3996kb
input:
99227 20385292 7 54 381 4 5 81 784 4 58 5 952 707 62 88 73 88 51 6 37 895 4 442 10 924 2 34 139 938 95 460 648 5 935 933 8 3 53 275 316 232 5 221 4 290 31 17 19 984 498 49 666 295 928 6 5 6 79 48 7 2 241 6 790 8 1 7 4 280 387 4 59 12 8 92 8 69 24 999 61 4 9 296 62 3 79 46 465 10 2 8 10 971 7 6 366 5...
output:
637667063
result:
ok single line: '637667063'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3916kb
input:
98617 60313539 61 57 6 2 10 65 110 252 10 9 965 978 10 40 735 1 3 907 498 594 310 49 679 17 45 891 9 10 850 28 61 533 26 34 1 13 28 81 61 822 542 8 80 28 7 2 7 46 5 27 590 58 2 37 535 618 4 105 19 8 740 3 422 59 675 443 99 9 60 97 267 71 82 61 1 4 74 334 55 141 3 51 16 40 249 454 78 426 3 922 182 23...
output:
68675763
result:
ok single line: '68675763'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3980kb
input:
95725 94234463 87 89 98 81 96 5 56 2 462 50 2 6 10 487 249 516 5 77 91 41 142 32 6 5 2 8 933 6 3 8 52 2 1 60 3 4 68 70 6 10 958 9 2 13 9 99 3 92 49 6 5 9 6 9 4 976 781 4 6 86 58 425 368 9 10 6 23 11 593 935 1 10 201 83 303 2 74 373 65 3 25 39 30 5 16 73 8 1 25 984 92 5 41 4 3 44 99 10 21 570 20 978 ...
output:
472808952
result:
ok single line: '472808952'
Test #6:
score: 0
Accepted
time: 1ms
memory: 3660kb
input:
12375 22498260 580 10 4 43 6 7 27 81 10 810 9 273 26 27 4 491 9 172 10 10 10 10 1 279 8 5 7 88 2 537 3 86 1 1 198 4 54 564 71 46 728 8 55 12 76 7 265 7 29 59 64 63 22 6 36 194 6 10 1 24 40 400 279 6 6 761 8 92 67 889 892 3 7 962 36 34 517 46 1 278 8 9 15 66 6 219 889 9 49 89 26 167 935 40 8 8 779 35...
output:
519237562
result:
ok single line: '519237562'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3784kb
input:
44102 28076277 82 736 238 7 62 91 873 1 12 34 6 96 475 96 2 2 8 7 100 158 2 312 94 69 74 8 533 114 23 172 78 1 3 3 303 7 435 5 5 92 135 88 2 75 99 6 2 2 47 434 852 6 574 681 46 610 510 10 6 821 10 913 9 48 9 53 599 27 5 74 16 659 6 11 1 18 6 862 527 615 712 413 698 800 180 5 1 12 3 8 51 23 85 423 67...
output:
163304014
result:
ok single line: '163304014'
Test #8:
score: 0
Accepted
time: 2ms
memory: 3856kb
input:
65754 70204311 4 42 68 578 56 14 21 1 3 815 59 159 682 110 7 56 4 927 734 92 2 19 48 33 8 901 663 45 457 687 810 5 4 39 311 18 10 56 5 8 435 6 936 14 4 265 33 318 509 4 7 623 269 590 5 61 98 43 7 337 197 3 6 30 1 89 652 2 3 87 322 7 1 71 39 825 14 6 995 969 4 435 840 7 504 36 466 764 3 10 46 269 3 5...
output:
744186938
result:
ok single line: '744186938'
Test #9:
score: 0
Accepted
time: 1ms
memory: 3576kb
input:
11419 56843065 537 284 89 97 833 365 54 63 14 3 30 49 4 25 5 11 12 4 11 7 34 32 71 76 91 7 25 734 6 91 31 10 20 4 91 940 4 8 38 10 2 969 3 75 763 3 23 3 858 15 92 55 6 3 95 65 5 10 4 108 74 37 1 6 668 345 985 80 3 86 294 64 96 699 170 8 516 4 358 5 5 74 54 10 3 32 5 2 6 10 415 33 626 238 201 89 71 3...
output:
477005076
result:
ok single line: '477005076'
Test #10:
score: 0
Accepted
time: 1ms
memory: 3700kb
input:
23528 42296737 538 1 972 6 4 87 864 861 6 48 933 45 517 36 927 271 9 1 8 4 10 29 9 7 57 286 31 640 39 445 1 29 491 12 586 2 78 23 54 13 9 2 35 6 9 60 10 4 6 98 121 63 65 202 7 97 96 750 676 2 554 528 89 7 4 369 744 261 6 754 463 330 336 88 316 4 543 71 581 439 94 9 839 1 5 103 751 7 6 592 1 11 33 34...
output:
187686565
result:
ok single line: '187686565'
Test #11:
score: 0
Accepted
time: 2ms
memory: 3796kb
input:
67768 89934973 878 30 10 67 747 760 7 725 787 2 24 66 420 53 67 485 515 361 826 6 47 421 859 89 1 221 5 7 197 10 4 6 13 3 1 697 594 2 883 248 1 72 14 8 730 840 2 9 9 7 8 729 31 61 3 81 31 107 1 8 10 279 19 8 77 8 116 218 625 19 2 1 35 9 532 83 10 1 229 10 215 3 5 4 96 4 489 944 647 460 442 8 714 31 ...
output:
526231202
result:
ok single line: '526231202'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
22562 85483157 1 37 3 74 72 3 351 3 475 10 6 5 393 6 849 783 665 7 66 26 2 80 698 5 858 97 2 3 759 75 61 6 357 86 68 10 7 29 2 4 726 419 440 69 129 877 7 7 6 1 522 527 65 292 35 7 445 10 79 79 521 1 692 29 9 78 4 10 83 411 327 90 164 6 6 98 612 778 259 1 75 57 15 8 1 83 110 97 8 10 9 281 4 68 325 32...
output:
643382007
result:
ok single line: '643382007'
Test #13:
score: 0
Accepted
time: 1ms
memory: 3888kb
input:
51734 73756310 628 333 7 2 5 278 86 5 263 966 64 502 1 296 779 569 2 600 83 572 1 3 94 9 2 374 248 1 545 9 3 388 583 162 91 6 2 2 50 8 7 1 33 501 7 8 85 809 3 2 401 111 1 246 6 6 5 3 10 6 5 3 688 556 952 5 5 878 52 16 650 4 490 58 36 19 69 90 10 10 878 35 75 5 30 1 5 1 862 32 230 54 27 727 973 6 9 1...
output:
27002320
result:
ok single line: '27002320'
Test #14:
score: 0
Accepted
time: 2ms
memory: 3928kb
input:
67345 58558173 9 57 686 75 9 40 724 76 2 907 740 35 7 6 4 5 686 123 305 941 10 53 13 339 100 57 1 933 543 24 2 354 182 879 67 3 499 473 721 1 909 4 401 1 799 12 22 992 98 4 980 100 7 10 81 3 958 64 287 695 617 160 35 53 10 88 2 11 426 416 89 37 3 770 7 7 28 2 706 807 316 431 2 738 1 83 3 3 851 57 81...
output:
493192523
result:
ok single line: '493192523'
Test #15:
score: 0
Accepted
time: 1ms
memory: 3672kb
input:
21584 95916798 14 90 757 28 994 43 919 782 272 32 2 13 65 71 25 96 66 33 4 787 49 37 980 550 5 106 47 717 3 6 2 15 6 529 60 32 596 4 1 3 26 6 60 6 691 28 54 4 30 475 75 758 10 4 999 9 18 19 3 7 909 38 1 977 51 8 77 2 3 3 89 70 27 16 23 31 763 10 6 207 570 4 803 6 3 4 81 9 29 3 10 13 75 326 59 8 1 8 ...
output:
834154384
result:
ok single line: '834154384'
Test #16:
score: 0
Accepted
time: 0ms
memory: 3940kb
input:
87324 70134865 22 52 7 359 7 692 85 5 293 7 94 4 52 64 14 5 408 4 12 4 78 7 102 1 984 50 2 34 92 2 315 299 40 96 3 2 8 2 3 77 16 39 139 79 710 9 7 10 5 4 5 413 48 597 2 239 61 1 821 8 9 54 7 15 50 93 477 7 210 90 24 967 856 50 591 74 5 7 162 847 10 29 6 78 3 3 21 294 75 957 8 39 7 67 951 315 784 713...
output:
785708962
result:
ok single line: '785708962'
Test #17:
score: 0
Accepted
time: 2ms
memory: 3936kb
input:
85308 32430583 23 134 1 77 7 23 3 6 6 785 5 9 10 84 827 1 38 4 68 19 105 851 37 69 610 10 481 263 81 6 4 4 858 867 2 72 684 90 10 781 4 73 2 532 10 290 488 331 968 51 354 70 80 4 462 58 880 147 370 5 10 27 777 8 46 424 20 7 65 11 9 232 5 29 71 529 48 1 209 8 5 42 10 503 9 5 7 14 213 15 10 646 740 5 ...
output:
303652237
result:
ok single line: '303652237'
Test #18:
score: 0
Accepted
time: 1ms
memory: 3524kb
input:
7798 25077947 89 675 9 131 22 7 379 460 61 15 409 5 25 1000 411 31 13 600 9 7 6 61 726 418 82 6 455 32 201 12 6 9 2 1 564 8 722 4 91 2 48 299 7 3 100 96 39 42 685 62 5 86 7 1000 44 5 252 50 8 30 868 49 1 410 65 4 8 52 4 99 6 87 4 8 3 9 722 4 264 39 58 60 3 688 420 1 735 341 768 916 323 5 89 91 9 2 1...
output:
460206660
result:
ok single line: '460206660'
Test #19:
score: 0
Accepted
time: 1ms
memory: 3688kb
input:
39046 30537748 60 26 6 323 90 99 625 880 983 377 97 79 16 409 4 465 41 9 3 77 4 6 24 6 2 504 684 27 22 10 383 322 795 2 38 2 53 204 59 234 5 29 3 820 598 7 4 9 2 15 5 10 4 562 1 76 810 94 78 3 886 68 478 87 498 196 1 545 86 2 2 2 70 799 586 974 5 4 9 561 20 37 5 14 753 2 13 467 3 96 70 23 988 4 42 1...
output:
685060444
result:
ok single line: '685060444'
Test #20:
score: 0
Accepted
time: 2ms
memory: 3952kb
input:
70150 83354621 858 18 8 822 101 9 61 1 477 2 30 10 198 8 3 29 515 88 7 92 307 8 6 65 923 46 51 350 898 85 6 44 3 93 975 905 783 4 10 15 36 2 50 456 869 4 6 10 23 10 524 328 73 2 751 16 10 1 134 17 22 10 308 995 385 1 38 703 79 9 3 3 292 241 377 138 9 68 76 28 709 8 489 1 21 1 39 60 879 4 9 491 4 781...
output:
564425180
result:
ok single line: '564425180'
Test #21:
score: 0
Accepted
time: 1ms
memory: 3584kb
input:
23366 85095190 717 9 5 997 546 814 10 24 18 64 1 30 13 2 6 19 3 617 334 8 2 5 934 2 5 39 472 17 7 937 537 46 34 50 82 19 459 22 8 972 73 3 9 220 1 9 21 11 748 283 679 660 4 475 524 5 236 837 90 12 73 574 10 9 15 84 2 4 2 79 837 7 360 6 130 107 913 6 75 3 81 70 2 56 705 9 15 104 52 96 5 8 59 421 3 8 ...
output:
995278409
result:
ok single line: '995278409'
Test #22:
score: 0
Accepted
time: 1ms
memory: 3644kb
input:
38728 96801118 69 71 9 806 10 21 5 409 10 603 9 49 769 1 723 745 29 7 8 7 54 75 1 367 25 7 12 5 83 29 8 74 48 38 933 18 3 9 8 71 191 39 304 59 514 74 235 6 207 751 2 586 52 240 94 25 6 764 18 784 740 48 3 7 87 30 1 2 313 7 440 10 9 1 34 31 85 172 1 1 4 65 6 94 10 255 616 99 40 88 463 853 2 3 7 95 68...
output:
192324446
result:
ok single line: '192324446'
Test #23:
score: 0
Accepted
time: 1ms
memory: 3752kb
input:
54893 25761440 46 594 5 525 2 622 3 452 2 50 66 70 8 931 809 7 6 75 918 961 44 272 27 10 277 952 38 7 987 831 261 65 388 5 8 731 424 48 5 349 49 39 2 468 135 84 8 7 36 918 1 6 60 5 8 90 1 2 88 41 4 4 9 571 3 534 43 95 669 70 872 997 333 749 9 82 369 69 349 100 16 8 5 144 686 24 155 85 84 98 986 29 6...
output:
211786070
result:
ok single line: '211786070'
Test #24:
score: 0
Accepted
time: 2ms
memory: 3992kb
input:
100000 87615880 837 482 96 2 26 7 26 517 24 34 572 89 6 36 6 321 938 2 595 7 207 3 154 869 271 350 775 3 86 8 3 850 68 91 97 932 398 636 9 290 6 10 269 3 450 121 58 75 887 368 90 1 2 2 90 5 485 9 10 8 91 8 34 85 68 1 91 10 29 1 4 19 129 11 7 550 84 5 6 264 37 9 3 4 6 700 104 18 11 1 432 2 60 26 376 ...
output:
579637024
result:
ok single line: '579637024'
Test #25:
score: 0
Accepted
time: 2ms
memory: 4076kb
input:
100000 65033003 26 86 846 2 10 410 700 83 7 206 970 1 188 10 5 1 34 9 841 6 3 10 69 513 88 3 4 43 586 12 21 5 6 7 59 56 2 6 16 42 625 53 38 18 9 10 4 99 68 94 33 324 47 752 5 253 10 7 5 105 19 6 9 54 7 3 1 9 81 532 100 92 79 98 8 8 416 93 4 4 871 95 5 4 465 1 35 88 61 91 9 503 92 8 46 276 3 765 2 3 ...
output:
189684020
result:
ok single line: '189684020'
Test #26:
score: 0
Accepted
time: 2ms
memory: 3984kb
input:
100000 95495503 9 3 684 3 2 20 272 119 611 6 100 39 1 10 57 32 128 600 4 10 3 728 24 49 24 23 901 78 48 17 298 7 570 5 977 47 10 997 5 630 908 5 52 46 891 43 791 8 11 6 4 6 6 8 4 277 318 27 4 21 76 423 2 35 7 787 2 578 3 100 84 20 100 952 870 1 51 3 202 775 906 187 7 5 81 568 6 811 97 8 58 392 6 4 4...
output:
157902781
result:
ok single line: '157902781'
Test #27:
score: 0
Accepted
time: 2ms
memory: 4068kb
input:
100000 75523819 962 6 229 5 9 475 49 87 9 16 451 8 998 77 4 3 50 773 148 57 10 434 3 8 17 611 7 6 84 551 3 923 3 3 9 7 2 82 60 1 404 5 76 54 729 8 4 60 14 76 10 43 350 51 716 18 579 67 20 719 6 304 82 432 5 831 408 178 78 13 886 1 504 2 47 6 33 3 87 6 265 413 276 369 550 24 710 437 981 4 61 84 56 46...
output:
177262990
result:
ok single line: '177262990'
Test #28:
score: 0
Accepted
time: 0ms
memory: 4012kb
input:
100000 63310248 25 19 3 725 14 44 472 878 837 535 7 82 4 9 520 6 684 545 3 95 56 36 620 529 5 22 192 101 7 62 20 31 2 79 515 5 4 292 165 932 7 6 62 9 49 821 3 548 240 693 10 6 561 5 31 9 78 9 91 11 7 6 661 238 235 997 913 66 10 532 94 5 398 40 3 6 3 73 5 7 4 49 9 193 6 90 3 8 78 24 53 3 2 684 45 100...
output:
487779880
result:
ok single line: '487779880'
Test #29:
score: 0
Accepted
time: 2ms
memory: 3888kb
input:
100000 20664254 3 41 611 75 73 54 37 545 18 674 583 63 856 425 817 74 9 53 127 445 93 28 15 431 871 8 73 9 563 2 336 342 713 2 22 92 82 681 906 2 7 6 2 976 22 440 870 891 6 2 684 132 51 49 4 198 9 2 2 440 4 7 258 65 5 759 78 709 10 15 2 5 72 873 4 36 67 4 8 81 15 6 97 9 8 9 485 85 7 224 766 2 881 10...
output:
6466541
result:
ok single line: '6466541'
Test #30:
score: 0
Accepted
time: 2ms
memory: 3916kb
input:
100000 66766519 10 101 593 6 2 80 945 7 57 983 10 147 8 8 40 94 1 96 8 947 134 326 153 813 379 80 7 61 2 878 96 362 734 210 28 1 36 65 5 651 64 8 2 9 554 972 10 74 1 10 48 7 71 8 7 186 758 2 45 308 7 82 4 76 29 95 53 4 28 837 8 4 61 587 2 6 65 8 963 45 68 212 10 209 3 23 2 6 964 60 80 904 4 92 972 1...
output:
193336098
result:
ok single line: '193336098'
Test #31:
score: 0
Accepted
time: 2ms
memory: 3928kb
input:
100000 32981910 1 100 8 93 5 414 5 16 851 9 4 13 38 649 5 86 64 650 70 4 279 9 9 595 460 22 95 791 688 356 9 134 3 6 7 9 950 42 765 3 39 438 10 2 368 27 507 898 31 52 2 55 70 14 13 772 9 504 623 5 80 88 49 10 161 450 1 2 37 130 53 5 8 2 3 28 5 84 72 6 63 3 69 7 2 10 75 6 5 4 9 2 304 726 80 59 690 28...
output:
748643893
result:
ok single line: '748643893'
Test #32:
score: 0
Accepted
time: 2ms
memory: 4012kb
input:
100000 84852136 13 1 63 6 8 10 3 4 34 11 7 62 89 672 61 71 87 86 850 45 13 9 31 100 95 4 7 7 229 521 19 24 4 820 729 1 2 27 25 14 67 5 7 412 5 9 89 299 2 79 94 3 983 6 6 535 12 7 2 179 547 4 85 1 472 620 8 22 1 97 9 6 29 5 16 32 52 85 32 10 517 7 64 61 82 19 88 56 9 706 10 739 6 478 68 7 268 980 2 3...
output:
407841116
result:
ok single line: '407841116'
Test #33:
score: 0
Accepted
time: 2ms
memory: 3980kb
input:
100000 19134271 261 288 469 61 38 898 8 3 53 1 54 402 1 30 95 82 217 78 8 38 318 1 909 14 85 668 11 298 1 18 110 882 40 876 3 760 45 917 788 190 41 5 77 523 7 919 817 162 250 450 198 272 72 692 4 2 140 59 941 2 10 7 88 349 191 609 8 564 32 55 115 7 5 467 107 68 6 365 58 355 4 6 54 413 6 334 526 713 ...
output:
871947713
result:
ok single line: '871947713'