QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#199216#6887. Data GenerationhazeWA 39ms3516kbC++231.1kb2023-10-03 23:07:192023-10-03 23:07:20

Judging History

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

  • [2023-10-03 23:07:20]
  • 评测
  • 测评结果:WA
  • 用时:39ms
  • 内存:3516kb
  • [2023-10-03 23:07:19]
  • 提交

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;

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

int main(){
	ll T = read();
	while(T --){
		ll n = read() % mod, m = read() % mod;
		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: 39ms
memory: 3516kb

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
60176292
637928890
241494492
73405017
434625428
90562828
985393145
144377539
38908492
848220189
110073143
711096361
683279099
830757079
138030335
926874340
184055154
25178328
1
323104191
798182621
300023295
273151054
185725449
929159480
16587770
833553979
997849365
0
219852419
416522410
358...

result:

wrong answer 3rd lines differ - expected: '660407710', found: '637928890'