QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#199211 | #6887. Data Generation | haze | WA | 81ms | 3884kb | C++23 | 1.2kb | 2023-10-03 23:03:22 | 2023-10-03 23:03:22 |
Judging History
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() % 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;
}
详细
Test #1:
score: 0
Wrong Answer
time: 81ms
memory: 3884kb
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'