QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#394536 | #3681. 模积和 | LVJBot1 | 40 | 4ms | 3860kb | C++14 | 1.6kb | 2024-04-20 15:51:32 | 2024-04-20 15:51:32 |
Judging History
answer
/* Submission UUID: af2bee91-3cde-452b-8b91-185733a8de1c. */
#include<bits/stdc++.h>
#define x first
#define y second
#define pb push_back
#define eb emplace_back
#define pf push_front
#define desktop "C:\\Users\\incra\\Desktop\\"
using namespace std;typedef long long LL;typedef unsigned long long ULL;typedef pair<int,int>PII;const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};bool LAST=false;istream&operator>>(istream&in,char*s){if (LAST) return in;char ch=in.get ();while ((isspace (ch)||ch=='\n')&&ch !=EOF) ch=in.get ();int n=0;while (!(isspace (ch)||ch=='\n')&&ch !=EOF) s[n++]=ch,ch=in.get ();s[n]='\0';if (ch==EOF) LAST=true;return in;}template<typename T1,typename T2>bool tomax (T1&x,T2 y){if (y>x) return x=y,true;return false;}template<typename T1,typename T2>bool tomin (T1&x,T2 y){if (y<x) return x=y,true;return false;}LL power (LL a,LL b,LL p){LL ans=1;while (b){if (b&1) ans=ans*a%p;a=a*a%p;b/=2;}return ans;}
#define LL128 __int128
const int MOD=19940417;LL128 n,m;LL128 sum1 (LL128 l,LL128 r,LL128 maxr=m){tomin (r,maxr);return (l+r)*(r-l+1)/2;}LL128 tmp_sum (LL128 x){return x*(x+1)*(2*x+1)/6;}LL128 sum2 (LL128 l,LL128 r){return tmp_sum (r)-tmp_sum (l-1);}LL128 get1 (LL128 n,LL128 maxr){LL128 ans=0;for (LL128 l=1;l<=n;){LL128 r=n/(n/l);ans+=(n/l)*sum1 (l,r,maxr);l=r+1;}return ans;}LL128 get2 (LL128 n,LL128 m){LL128 ans=0;for (LL128 l=1;l<=n;){LL128 r=min (n/(n/l),m/(m/l));ans+=(n/l)*(m/l)*sum2 (l,r);l=r+1;}return ans;}int main (){LL t1,t2;cin>>t1>>t2;n=t1,m=t2;if (n>m) swap (n,m);cout<<(LL)(((n*n-get1 (n,n))*(m*m-get1 (m,m))-(n*n*m-m*get1 (n,n)-n*get1 (m,n)+get2 (n,m)))%MOD)<<endl;return 0;}
详细
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3832kb
input:
195 631
output:
6333386
result:
wrong answer 1st lines differ - expected: '13499636', found: '6333386'
Test #2:
score: 0
Wrong Answer
time: 1ms
memory: 3580kb
input:
64 10872681
output:
-13040082
result:
wrong answer 1st lines differ - expected: '1651075', found: '-13040082'
Test #3:
score: 0
Wrong Answer
time: 0ms
memory: 3572kb
input:
75 135111825
output:
-7860527
result:
wrong answer 1st lines differ - expected: '1099449', found: '-7860527'
Test #4:
score: 0
Wrong Answer
time: 1ms
memory: 3768kb
input:
63 116177601
output:
-3449411
result:
wrong answer 1st lines differ - expected: '17215072', found: '-3449411'
Test #5:
score: 10
Accepted
time: 1ms
memory: 3536kb
input:
405041 602225
output:
4906861
result:
ok single line: '4906861'
Test #6:
score: 10
Accepted
time: 1ms
memory: 3572kb
input:
727429 937589
output:
4099574
result:
ok single line: '4099574'
Test #7:
score: 0
Wrong Answer
time: 2ms
memory: 3596kb
input:
70337281 243937321
output:
13024794
result:
wrong answer 1st lines differ - expected: '16331489', found: '13024794'
Test #8:
score: 10
Accepted
time: 2ms
memory: 3768kb
input:
136349929 257383657
output:
19504124
result:
ok single line: '19504124'
Test #9:
score: 10
Accepted
time: 1ms
memory: 3860kb
input:
539154474 305587405
output:
8781805
result:
ok single line: '8781805'
Test #10:
score: 0
Wrong Answer
time: 4ms
memory: 3572kb
input:
719865785 277727262
output:
7867564
result:
wrong answer 1st lines differ - expected: '937958', found: '7867564'