QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#369470 | #6170. 凸多边形正则划分问题 | Crysfly | 0 | 260ms | 26540kb | C++17 | 2.7kb | 2024-03-28 11:12:13 | 2024-03-28 11:12:13 |
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 int long long
#define ull unsigned long long
#define SZ(x) ((int)((x).size()))
#define ALL(x) (x).begin(),(x).end()
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,modint b){return a.x==b.x;}
friend bool operator !=(modint a,modint b){return a.x!=b.x;}
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
modint out;
void work()
{
int n,k;
if(!(cin>>n>>k)){
cout<<out.x;
exit(0);
}
k-=2;
modint res=1;
int t=n*k+n+1;
For(i,0,n-1) res*=t-i;
res*=ifac[n];
res/=t;
// cout<<"res "<<res.x<<"\n";
out+=res;
}
signed main()
{
initC(2000001);
while(1)work();
cout<<out.x;
return 0;
}
/*
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 17ms
memory: 26516kb
input:
3724 183 1477 192 1614 85 3072 50 3794 51 286 16 912 200 4581 185 2595 104 3004 58 4289 98 4971 109 1106 191 1005 42 2883 100 4002 162 3641 95 1203 162 3827 198 4594 99 3350 190 1039 16 4980 199 3014 52 3465 170 3062 39 3110 148 3055 59 4428 56 155 28 4723 176 2303 194 2481 106 2171 163 4416 39 783 ...
output:
375382770
result:
wrong answer 1st numbers differ - expected: '918500577', found: '375382770'
Test #2:
score: 0
Wrong Answer
time: 17ms
memory: 26452kb
input:
493 113 551 110 2865 168 3926 12 2127 4 158 14 3506 42 4069 113 3809 97 1614 160 4190 126 2654 126 2243 179 3382 153 4352 96 2214 59 2385 157 1670 130 334 26 391 22 3781 84 4863 102 2424 193 361 161 1334 86 540 48 1368 95 1767 105 454 72 1001 54 2 175 1254 153 2076 164 3773 159 254 105 4094 102 1155...
output:
677383642
result:
wrong answer 1st numbers differ - expected: '278300495', found: '677383642'
Test #3:
score: 0
Wrong Answer
time: 17ms
memory: 26444kb
input:
1211 11 4783 188 1844 122 3965 28 1271 79 1325 45 4794 109 666 70 3626 69 1926 162 4973 153 4531 192 2789 34 4432 173 2442 115 3228 132 4414 20 4205 126 1940 61 4779 109 1604 111 3284 84 1382 164 483 113 2604 135 4676 36 353 29 2621 154 2328 142 1350 63 3900 3 2193 68 1362 14 1999 182 3011 148 3742 ...
output:
191926021
result:
wrong answer 1st numbers differ - expected: '17024829', found: '191926021'
Test #4:
score: 0
Wrong Answer
time: 24ms
memory: 26540kb
input:
3735 5 2023 48 1260 107 2616 183 3834 103 3133 7 3905 197 1220 156 461 52 4105 69 1728 160 3497 87 130 108 2644 182 4127 65 3594 187 857 190 4517 123 1773 144 4481 109 3211 71 3174 69 3547 36 1014 106 558 102 4180 8 1605 38 3339 37 230 190 4241 117 1399 79 218 56 2310 70 2571 17 724 190 4360 17 454 ...
output:
722748324
result:
wrong answer 1st numbers differ - expected: '189530990', found: '722748324'
Test #5:
score: 0
Wrong Answer
time: 15ms
memory: 26408kb
input:
2883 30 1925 39 3659 48 4031 9 2701 25 248 181 1144 167 3583 81 3314 140 1309 23 420 34 4443 73 2101 11 2493 9 1794 185 1160 76 1171 116 3701 75 1643 108 3213 175 3238 154 2458 42 357 95 4746 198 3730 20 1957 78 4827 57 18 21 3083 184 2811 28 486 100 3143 81 2257 143 3329 85 4924 87 1960 91 4283 135...
output:
885134575
result:
wrong answer 1st numbers differ - expected: '912502476', found: '885134575'
Test #6:
score: 0
Wrong Answer
time: 116ms
memory: 26496kb
input:
185470 192 313015 43 266721 4 498452 124 404256 83 159420 131 59124 3 304653 55 376212 11 77545 8 335495 118 171948 24 480583 54 25648 111 188377 198 287993 147 301395 94 125099 115 236067 41 14221 130 462939 174 209707 104 473328 95 284292 75 210287 62 119769 80 152455 170 440561 116 496937 71 4080...
output:
86488725
result:
wrong answer 1st numbers differ - expected: '93537750', found: '86488725'
Test #7:
score: 0
Wrong Answer
time: 123ms
memory: 26404kb
input:
227203 32 335466 52 254542 175 345804 97 463297 8 274911 57 408890 195 201724 104 415282 130 343806 199 300945 140 247351 118 380862 123 387076 134 432511 4 281376 75 90573 16 476656 133 305177 46 58929 3 3744 16 435138 179 390012 136 110462 28 193946 136 88561 101 120478 146 116032 170 218654 64 38...
output:
164444405
result:
wrong answer 1st numbers differ - expected: '622781568', found: '164444405'
Test #8:
score: 0
Wrong Answer
time: 249ms
memory: 26252kb
input:
108502 90 126818 198 56913 63 325475 66 1003654 58 790755 191 916440 185 765328 113 323634 106 203481 112 96056 120 432062 157 746426 110 65855 148 259267 193 181860 120 631385 194 801825 32 911187 71 681049 165 766181 110 566150 106 93769 17 627267 149 344810 6 778170 74 357214 73 1042417 105 19288...
output:
653267886
result:
wrong answer 1st numbers differ - expected: '987705581', found: '653267886'
Test #9:
score: 0
Wrong Answer
time: 225ms
memory: 26492kb
input:
309044 37 863984 145 357403 128 223264 192 791587 32 378940 101 909668 138 748483 105 1093663 97 263491 116 140862 165 879891 124 117521 121 687899 124 888035 123 717143 19 118848 13 881066 34 773546 169 392604 23 94597 148 242654 101 987236 28 698465 192 413640 161 866091 131 584336 47 700950 157 4...
output:
342279177
result:
wrong answer 1st numbers differ - expected: '916529987', found: '342279177'
Test #10:
score: 0
Wrong Answer
time: 260ms
memory: 26492kb
input:
538127 64 647353 179 353055 123 651309 46 862715 191 1008278 173 912962 89 45540 9 817753 143 950270 135 461599 79 272515 11 1042001 136 17974 63 47832 35 253287 65 576032 190 336256 135 753810 112 677350 165 313178 18 782417 36 672526 9 763363 124 821173 54 1040962 31 15749 89 826236 137 1077710 13...
output:
216176945
result:
wrong answer 1st numbers differ - expected: '841484027', found: '216176945'