QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#620210#6425. Harmonious RectanglexDarkbluex#WA 1ms3668kbC++171.6kb2024-10-07 17:01:262024-10-07 17:01:34

Judging History

你现在查看的是最新测评结果

  • [2024-10-07 17:01:34]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3668kb
  • [2024-10-07 17:01:26]
  • 提交

answer

#include <bits/stdc++.h>
using i64 = long long;
constexpr int MOD = 1e9 + 7;
constexpr i64 ans[9][9] = {{0, 0, 0, 0, 0, 0, 0, 0, 0}, 
                            {0, 15, 339, 4761, 52929, 517761, 4767849, 43046721, 387420489}, 
                            {0, 339, 16485, 518265, 14321907, 387406809, 460338013, 429534507, 597431612}, 
                            {0, 4761, 518265, 43022385, 486780060, 429534507, 792294829, 175880701, 246336683},
                            {0, 52929, 14321907, 486780060, 288599194, 130653412, 748778899, 953271190, 644897553},
                            {0, 517761, 387406809, 429534507, 130653412, 246336683, 579440654, 412233812, 518446848},
                            {0, 4767849, 460338013, 792294829, 748778899, 579440654, 236701429, 666021604, 589237756},
                            {0, 43046721, 429534507, 175880701, 953271190, 412233812, 666021604, 767713261, 966670169},
                            {0, 387420489, 597431612, 246336683, 644897553, 518446848, 589237756, 966670169, 968803245},};

i64 qpow(i64 a, i64 b) {
    i64 ans = 1;
    for (; b; b >>= 1) {
        if (b & 1) ans = ans * a % MOD;
        a = a * a % MOD;
    }
    return ans;
}

void solve() {
    i64 n, m;
    std::cin >> n >> m;
    if (n <= 9 && m <= 9) {
        std::cout << ans[n - 1][m - 1] << '\n';
    } else {
        std::cout << (3, n * m) << '\n';
    }

}

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr), std::cout.tie(nullptr);

    int T;
    std::cin >> T;
    while (T--) {
        solve();
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
1 4
2 2
3 3

output:

0
15
16485

result:

ok 3 number(s): "0 15 16485"

Test #2:

score: -100
Wrong Answer
time: 1ms
memory: 3668kb

input:

10000
1 1
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
1 16
1 17
1 18
1 19
1 20
1 21
1 22
1 23
1 24
1 25
1 26
1 27
1 28
1 29
1 30
1 31
1 32
1 33
1 34
1 35
1 36
1 37
1 38
1 39
1 40
1 41
1 42
1 43
1 44
1 45
1 46
1 47
1 48
1 49
1 50
1 51
1 52
1 53
1 54
1 55
1 56
1 57
1 58
1 59
1 60
1 6...

output:

0
0
0
0
0
0
0
0
0
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
0
15
339...

result:

wrong answer 10th numbers differ - expected: '0', found: '10'