QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#673117 | #2383. Broken Watch | Yarema# | AC ✓ | 16ms | 10744kb | Python3 | 368b | 2024-10-24 20:39:16 | 2024-10-24 20:39:16 |
Judging History
answer
def f(n):
return n * (n + 1) // 2
def g(n):
return n * (n + 1) * (2 * n + 1) // 6;
a, b, c, n = map(int, (input().split()))
ans = 0
if (n % 2 == 1):
ans = g(n // 2)
else:
ans = g(n // 2 - 1) + 3 * f(n // 2 - 1)
if (a == b and b == c):
ans *= 1
elif a != b and b != c and a != c:
ans *= 6
else:
ans *= 3
mod = 2**64
print(ans % mod)
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 13ms
memory: 10580kb
input:
1193 2741 3559 2
output:
0
result:
ok single line: '0'
Test #2:
score: 0
Accepted
time: 7ms
memory: 10592kb
input:
1193 2741 3559 17
output:
1224
result:
ok single line: '1224'
Test #3:
score: 0
Accepted
time: 13ms
memory: 10700kb
input:
1193 2741 2741 17
output:
612
result:
ok single line: '612'
Test #4:
score: 0
Accepted
time: 12ms
memory: 10596kb
input:
2741 2741 2741 17
output:
204
result:
ok single line: '204'
Test #5:
score: 0
Accepted
time: 13ms
memory: 10596kb
input:
1193 2741 3559 1193
output:
424483716
result:
ok single line: '424483716'
Test #6:
score: 0
Accepted
time: 16ms
memory: 10640kb
input:
1193 2741 2741 1193
output:
212241858
result:
ok single line: '212241858'
Test #7:
score: 0
Accepted
time: 10ms
memory: 10704kb
input:
2741 2741 2741 1193
output:
70747286
result:
ok single line: '70747286'
Test #8:
score: 0
Accepted
time: 11ms
memory: 10548kb
input:
1193 2741 3559 2000000000
output:
10584946410820579328
result:
ok single line: '10584946410820579328'
Test #9:
score: 0
Accepted
time: 15ms
memory: 10600kb
input:
1193 2741 2741 2000000000
output:
14515845242265065472
result:
ok single line: '14515845242265065472'
Test #10:
score: 0
Accepted
time: 10ms
memory: 10740kb
input:
2741 2741 2741 2000000000
output:
4838615080755021824
result:
ok single line: '4838615080755021824'
Test #11:
score: 0
Accepted
time: 11ms
memory: 10592kb
input:
1193 2741 3559 2000000001
output:
7584946419820579328
result:
ok single line: '7584946419820579328'
Test #12:
score: 0
Accepted
time: 11ms
memory: 10644kb
input:
1193 2741 2741 2
output:
0
result:
ok single line: '0'
Test #13:
score: 0
Accepted
time: 15ms
memory: 10572kb
input:
1193 2741 2741 2000000001
output:
13015845246765065472
result:
ok single line: '13015845246765065472'
Test #14:
score: 0
Accepted
time: 15ms
memory: 10596kb
input:
2741 2741 2741 2000000001
output:
4338615082255021824
result:
ok single line: '4338615082255021824'
Test #15:
score: 0
Accepted
time: 9ms
memory: 10640kb
input:
1193 2741 3559 4000000000
output:
5339339113435979776
result:
ok single line: '5339339113435979776'
Test #16:
score: 0
Accepted
time: 10ms
memory: 10576kb
input:
1193 2741 2741 4000000000
output:
11893041593572765696
result:
ok single line: '11893041593572765696'
Test #17:
score: 0
Accepted
time: 11ms
memory: 10596kb
input:
2741 2741 2741 4000000000
output:
16262176580330622976
result:
ok single line: '16262176580330622976'
Test #18:
score: 0
Accepted
time: 3ms
memory: 10592kb
input:
1193 2741 3559 4000000001
output:
11786083205145531392
result:
ok single line: '11786083205145531392'
Test #19:
score: 0
Accepted
time: 7ms
memory: 10580kb
input:
1193 2741 2741 4000000001
output:
5893041602572765696
result:
ok single line: '5893041602572765696'
Test #20:
score: 0
Accepted
time: 15ms
memory: 10628kb
input:
2741 2741 2741 4000000001
output:
14262176583330622976
result:
ok single line: '14262176583330622976'
Test #21:
score: 0
Accepted
time: 8ms
memory: 10648kb
input:
1193 2741 3559 4294967295
output:
4611686020574871552
result:
ok single line: '4611686020574871552'
Test #22:
score: 0
Accepted
time: 16ms
memory: 10592kb
input:
1193 2741 2741 4294967295
output:
11529215047142211584
result:
ok single line: '11529215047142211584'
Test #23:
score: 0
Accepted
time: 16ms
memory: 10740kb
input:
2741 2741 2741 2
output:
0
result:
ok single line: '0'
Test #24:
score: 0
Accepted
time: 8ms
memory: 10576kb
input:
2741 2741 2741 4294967295
output:
9991986373617254400
result:
ok single line: '9991986373617254400'
Test #25:
score: 0
Accepted
time: 16ms
memory: 10648kb
input:
1193 2741 3559 4294967294
output:
18446744043644780556
result:
ok single line: '18446744043644780556'
Test #26:
score: 0
Accepted
time: 15ms
memory: 10744kb
input:
1193 2741 2741 4294967294
output:
18446744058677166086
result:
ok single line: '18446744058677166086'
Test #27:
score: 0
Accepted
time: 7ms
memory: 10636kb
input:
2741 2741 2741 4294967294
output:
12297829377462239234
result:
ok single line: '12297829377462239234'
Test #28:
score: 0
Accepted
time: 12ms
memory: 10520kb
input:
1193 2741 3559 3
output:
6
result:
ok single line: '6'
Test #29:
score: 0
Accepted
time: 11ms
memory: 10644kb
input:
1193 2741 2741 3
output:
3
result:
ok single line: '3'
Test #30:
score: 0
Accepted
time: 12ms
memory: 10640kb
input:
2741 2741 2741 3
output:
1
result:
ok single line: '1'
Test #31:
score: 0
Accepted
time: 16ms
memory: 10704kb
input:
1193 2741 3559 4
output:
24
result:
ok single line: '24'
Test #32:
score: 0
Accepted
time: 0ms
memory: 10704kb
input:
1193 2741 2741 4
output:
12
result:
ok single line: '12'
Test #33:
score: 0
Accepted
time: 13ms
memory: 10624kb
input:
2741 2741 2741 4
output:
4
result:
ok single line: '4'