QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#199209#6887. Data GenerationhazeWA 97ms3776kbC++231.2kb2023-10-03 23:01:012023-10-03 23:01:02

Judging History

你现在查看的是最新测评结果

  • [2023-10-03 23:01:02]
  • 评测
  • 测评结果:WA
  • 用时:97ms
  • 内存:3776kb
  • [2023-10-03 23:01:01]
  • 提交

answer

#include<bits/stdc++.h>
#define irep(i,l,r) for(int i = l; i <= r; ++i)
#define drep(i,r,l) for(int i = r; i >= l; --i)
#define ceil(pp,qq) (((pp)>0)^((qq)>0)?-Abs(pp)/Abs(qq):(pp)%(qq)?(pp)/(qq)+1:(pp)/(qq))
#define floor(pp,qq) (((pp)>0)^((qq)>0)?-ceil(abs(pp),abs(qq)):(pp)/(qq))
#define ll long long
using namespace std;
ll Abs(ll x){return x > 0 ? x : - x;}
inline ll read(){
	char ch = getchar();
	ll s = 0; bool w = 0;
	while(!isdigit(ch)){if(ch == '-')w = 1;ch = getchar();}
	while(isdigit(ch))s = (s << 3) + (s << 1) + (ch ^ 48), ch = getchar();
	return w ? - s : s;
}

const int itinf = 2e9;
const ll llinf = 4e18;
const ll mod = 998244353;
const int N = 500009;

inline ll mmul ( ll a, ll b, const ll& Mod )  {
	ll lf = a * ( b >> 25LL ) % Mod * ( 1LL << 25 ) % Mod ;
    ll rg = a * ( b & ( ( 1LL << 25 ) - 1 ) ) % Mod ;
	return ( lf + rg ) % Mod ;
}

ll qpow(ll base, ll b){
	ll ans = 1;
	while(b){
		if(b & 1)ans = mmul(ans, base, mod);
		base = mmul(base, base, mod), b >>= 1;
	}
	return ans;
}

int main(){
	ll T = read();
	while(T --){
		ll n = read(), m = read();
		printf("%lld\n",(n - (1 + (n - 1) * qpow
		((1 - 2 * qpow(n, mod - 2) % mod) + mod, m)
		) % mod + mod) % mod);
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 97ms
memory: 3776kb

input:

100000
19491001 19491001
999999999449325353 939501148
400027352 999999998707619026
999999998353720210 999999999303057191
1879045722 1874448608
999999998385974740 1710466660
109045962 999999998020190078
999999998217418921 999999998898659805
999999999999986692 999999998389218199
351693073 2130408866
1...

output:

79256423
781514985
660407710
42620036
601021657
162025328
33871948
920716578
651674567
313185571
805837881
700368815
711096361
895992243
753779600
419158396
893139514
184055154
728055491
1
115566774
72240859
318526456
194635229
300928093
232530344
724410205
204237922
960904659
0
16112156
609034316
5...

result:

wrong answer 2nd lines differ - expected: '60176292', found: '781514985'