# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
20012 |
2016-02-25T08:28:56 Z |
algoshipda |
창문 (kriii4_C) |
C++14 |
|
0 ms |
1720 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long long lld;
const lld MOD = 1e9 + 7;
inline void norm(lld& a)
{
a = ((a % MOD + MOD) % MOD);
}
inline lld norm2(lld a)
{
return a = ((a % MOD + MOD) % MOD);
}
inline void mult(lld& a, lld b)
{
norm(a);
norm(b);
a = 1ll * a * b;
norm(a);
}
inline lld mult2(lld a, lld b)
{
norm(a);
norm(b);
return norm2(1ll * a * b);
}
pair<lld, lld> extgcd(lld a, lld b)
{
if(b == 0) return {1,0};
pair<lld, lld> t = extgcd(b, a%b);
return {t.second, t.first - t.second*(a/b)};
}
lld inv(lld a)
{
return norm2(extgcd(a, MOD).first);
}
int main()
{
lld h, w;
scanf("%lld%lld",&h,&w);
h %= MOD;
w %= MOD;
lld b = mult2(mult2(mult2(h,(h+1)%MOD), mult2(w,(w+1)%MOD)), inv(4));
lld hh = h;
mult(hh, (h+1)%MOD);
mult(hh, (h+2)%MOD);
mult(hh, inv(6));
lld ww = w;
mult(ww, (w+1)%MOD);
mult(ww, (w+2)%MOD);
mult(ww, inv(6));
lld a = mult2(hh,ww);
mult(a, 9);
printf("%lld",mult2(a, inv(b)));
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1720 KB |
Output is correct |
2 |
Correct |
0 ms |
1720 KB |
Output is correct |
3 |
Correct |
0 ms |
1720 KB |
Output is correct |
4 |
Correct |
0 ms |
1720 KB |
Output is correct |
5 |
Correct |
0 ms |
1720 KB |
Output is correct |
6 |
Correct |
0 ms |
1720 KB |
Output is correct |
7 |
Correct |
0 ms |
1720 KB |
Output is correct |
8 |
Correct |
0 ms |
1720 KB |
Output is correct |
9 |
Correct |
0 ms |
1720 KB |
Output is correct |
10 |
Correct |
0 ms |
1720 KB |
Output is correct |
11 |
Correct |
0 ms |
1720 KB |
Output is correct |
12 |
Correct |
0 ms |
1720 KB |
Output is correct |
13 |
Correct |
0 ms |
1720 KB |
Output is correct |
14 |
Correct |
0 ms |
1720 KB |
Output is correct |
15 |
Correct |
0 ms |
1720 KB |
Output is correct |
16 |
Correct |
0 ms |
1720 KB |
Output is correct |
17 |
Correct |
0 ms |
1720 KB |
Output is correct |
18 |
Correct |
0 ms |
1720 KB |
Output is correct |
19 |
Correct |
0 ms |
1720 KB |
Output is correct |
20 |
Correct |
0 ms |
1720 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1720 KB |
Output is correct |
2 |
Correct |
0 ms |
1720 KB |
Output is correct |
3 |
Correct |
0 ms |
1720 KB |
Output is correct |
4 |
Correct |
0 ms |
1720 KB |
Output is correct |
5 |
Correct |
0 ms |
1720 KB |
Output is correct |
6 |
Correct |
0 ms |
1720 KB |
Output is correct |
7 |
Correct |
0 ms |
1720 KB |
Output is correct |
8 |
Correct |
0 ms |
1720 KB |
Output is correct |
9 |
Correct |
0 ms |
1720 KB |
Output is correct |
10 |
Correct |
0 ms |
1720 KB |
Output is correct |
11 |
Correct |
0 ms |
1720 KB |
Output is correct |
12 |
Correct |
0 ms |
1720 KB |
Output is correct |
13 |
Correct |
0 ms |
1720 KB |
Output is correct |
14 |
Correct |
0 ms |
1720 KB |
Output is correct |
15 |
Correct |
0 ms |
1720 KB |
Output is correct |
16 |
Correct |
0 ms |
1720 KB |
Output is correct |
17 |
Correct |
0 ms |
1720 KB |
Output is correct |
18 |
Correct |
0 ms |
1720 KB |
Output is correct |
19 |
Correct |
0 ms |
1720 KB |
Output is correct |
20 |
Correct |
0 ms |
1720 KB |
Output is correct |
21 |
Incorrect |
0 ms |
1720 KB |
Output isn't correct |
22 |
Halted |
0 ms |
0 KB |
- |