QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#896261#10030. Grand Prix of Array Countrotcar07AC ✓19ms3584kbC++23389b2025-02-13 07:59:522025-02-13 07:59:53

Judging History

This is the latest submission verdict.

  • [2025-02-13 07:59:53]
  • Judged
  • Verdict: AC
  • Time: 19ms
  • Memory: 3584kb
  • [2025-02-13 07:59:52]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std;
constexpr int N=1e5+5,mod=1e9+7;
typedef long long ll;
int main(){
    ll n,k;
    cin>>n>>k;
    if(n&1) cout<<k%mod*(k%mod)%mod<<'\n';
    else{
        ll ans=0;
        for(ll l=1,r;l<=k;l=r+1){
            r=k/(k/l);
            ans+=(r-l+1)%mod*((k/l)%mod)%mod*(k/l%mod)%mod;
        }
        cout<<ans%mod<<'\n';
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3584kb

input:

5 2

output:

4

result:

ok 1 number(s): "4"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

32 5

output:

32

result:

ok 1 number(s): "32"

Test #3:

score: 0
Accepted
time: 0ms
memory: 3456kb

input:

5 3

output:

9

result:

ok 1 number(s): "9"

Test #4:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

5 4

output:

16

result:

ok 1 number(s): "16"

Test #5:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

5 5

output:

25

result:

ok 1 number(s): "25"

Test #6:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

6 2

output:

5

result:

ok 1 number(s): "5"

Test #7:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

6 3

output:

11

result:

ok 1 number(s): "11"

Test #8:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

6 4

output:

22

result:

ok 1 number(s): "22"

Test #9:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

6 5

output:

32

result:

ok 1 number(s): "32"

Test #10:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

6 6

output:

52

result:

ok 1 number(s): "52"

Test #11:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

1000000000000 2

output:

5

result:

ok 1 number(s): "5"

Test #12:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

1000000000000 3

output:

11

result:

ok 1 number(s): "11"

Test #13:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

1000000000000 4

output:

22

result:

ok 1 number(s): "22"

Test #14:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

1000000000000 5

output:

32

result:

ok 1 number(s): "32"

Test #15:

score: 0
Accepted
time: 19ms
memory: 3584kb

input:

1000000000000 1000000000000

output:

840670140

result:

ok 1 number(s): "840670140"

Test #16:

score: 0
Accepted
time: 19ms
memory: 3456kb

input:

1000000000000 999999999999

output:

451060960

result:

ok 1 number(s): "451060960"

Test #17:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

999999999999 999999999999

output:

49014001

result:

ok 1 number(s): "49014001"

Test #18:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

999999999999 1000000000000

output:

49000000

result:

ok 1 number(s): "49000000"

Test #19:

score: 0
Accepted
time: 1ms
memory: 3584kb

input:

999999999999 2

output:

4

result:

ok 1 number(s): "4"

Test #20:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

999999999999 3

output:

9

result:

ok 1 number(s): "9"

Test #21:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

999999999999 4

output:

16

result:

ok 1 number(s): "16"

Test #22:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

999999999999 5

output:

25

result:

ok 1 number(s): "25"

Test #23:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

5 999999999999

output:

49014001

result:

ok 1 number(s): "49014001"

Test #24:

score: 0
Accepted
time: 19ms
memory: 3456kb

input:

6 999999999999

output:

451060960

result:

ok 1 number(s): "451060960"

Test #25:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

7 999999999999

output:

49014001

result:

ok 1 number(s): "49014001"

Test #26:

score: 0
Accepted
time: 19ms
memory: 3584kb

input:

8 999999999999

output:

451060960

result:

ok 1 number(s): "451060960"

Test #27:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

5 1000000000000

output:

49000000

result:

ok 1 number(s): "49000000"

Test #28:

score: 0
Accepted
time: 19ms
memory: 3584kb

input:

6 1000000000000

output:

840670140

result:

ok 1 number(s): "840670140"

Test #29:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

7 1000000000000

output:

49000000

result:

ok 1 number(s): "49000000"

Test #30:

score: 0
Accepted
time: 18ms
memory: 3584kb

input:

8 1000000000000

output:

840670140

result:

ok 1 number(s): "840670140"

Test #31:

score: 0
Accepted
time: 18ms
memory: 3584kb

input:

983302239554 983302239554

output:

62350851

result:

ok 1 number(s): "62350851"

Test #32:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

983302239553 983302239553

output:

384847475

result:

ok 1 number(s): "384847475"

Test #33:

score: 0
Accepted
time: 10ms
memory: 3328kb

input:

283302239554 283302239554

output:

579148388

result:

ok 1 number(s): "579148388"

Test #34:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

283302239553 283302239553

output:

289022341

result:

ok 1 number(s): "289022341"

Test #35:

score: 0
Accepted
time: 1ms
memory: 3584kb

input:

10000001 10000001

output:

19300001

result:

ok 1 number(s): "19300001"

Test #36:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

20000003 20000003

output:

117200009

result:

ok 1 number(s): "117200009"

Test #37:

score: 0
Accepted
time: 1ms
memory: 3584kb

input:

30000001 30000001

output:

53700001

result:

ok 1 number(s): "53700001"

Test #38:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

40000001 40000001

output:

68800001

result:

ok 1 number(s): "68800001"

Test #39:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

8 9

output:

115

result:

ok 1 number(s): "115"