QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#134148#6756. 桂花树hos_lyric#0 3ms3884kbC++144.2kb2023-08-03 09:49:562023-08-03 09:49:59

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-08-03 09:49:59]
  • 评测
  • 测评结果:0
  • 用时:3ms
  • 内存:3884kb
  • [2023-08-03 09:49:56]
  • 提交

answer

#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

using Int = long long;

template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
template <class T> ostream &operator<<(ostream &os, const vector<T> &as) { const int sz = as.size(); os << "["; for (int i = 0; i < sz; ++i) { if (i >= 256) { os << ", ..."; break; } if (i > 0) { os << ", "; } os << as[i]; } return os << "]"; }
template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; }
template <class T> bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; }
template <class T> bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; }

////////////////////////////////////////////////////////////////////////////////
template <unsigned M_> struct ModInt {
  static constexpr unsigned M = M_;
  unsigned x;
  constexpr ModInt() : x(0U) {}
  constexpr ModInt(unsigned x_) : x(x_ % M) {}
  constexpr ModInt(unsigned long long x_) : x(x_ % M) {}
  constexpr ModInt(int x_) : x(((x_ %= static_cast<int>(M)) < 0) ? (x_ + static_cast<int>(M)) : x_) {}
  constexpr ModInt(long long x_) : x(((x_ %= static_cast<long long>(M)) < 0) ? (x_ + static_cast<long long>(M)) : x_) {}
  ModInt &operator+=(const ModInt &a) { x = ((x += a.x) >= M) ? (x - M) : x; return *this; }
  ModInt &operator-=(const ModInt &a) { x = ((x -= a.x) >= M) ? (x + M) : x; return *this; }
  ModInt &operator*=(const ModInt &a) { x = (static_cast<unsigned long long>(x) * a.x) % M; return *this; }
  ModInt &operator/=(const ModInt &a) { return (*this *= a.inv()); }
  ModInt pow(long long e) const {
    if (e < 0) return inv().pow(-e);
    ModInt a = *this, b = 1U; for (; e; e >>= 1) { if (e & 1) b *= a; a *= a; } return b;
  }
  ModInt inv() const {
    unsigned a = M, b = x; int y = 0, z = 1;
    for (; b; ) { const unsigned q = a / b; const unsigned c = a - q * b; a = b; b = c; const int w = y - static_cast<int>(q) * z; y = z; z = w; }
    assert(a == 1U); return ModInt(y);
  }
  ModInt operator+() const { return *this; }
  ModInt operator-() const { ModInt a; a.x = x ? (M - x) : 0U; return a; }
  ModInt operator+(const ModInt &a) const { return (ModInt(*this) += a); }
  ModInt operator-(const ModInt &a) const { return (ModInt(*this) -= a); }
  ModInt operator*(const ModInt &a) const { return (ModInt(*this) *= a); }
  ModInt operator/(const ModInt &a) const { return (ModInt(*this) /= a); }
  template <class T> friend ModInt operator+(T a, const ModInt &b) { return (ModInt(a) += b); }
  template <class T> friend ModInt operator-(T a, const ModInt &b) { return (ModInt(a) -= b); }
  template <class T> friend ModInt operator*(T a, const ModInt &b) { return (ModInt(a) *= b); }
  template <class T> friend ModInt operator/(T a, const ModInt &b) { return (ModInt(a) /= b); }
  explicit operator bool() const { return x; }
  bool operator==(const ModInt &a) const { return (x == a.x); }
  bool operator!=(const ModInt &a) const { return (x != a.x); }
  friend std::ostream &operator<<(std::ostream &os, const ModInt &a) { return os << a.x; }
};
////////////////////////////////////////////////////////////////////////////////

constexpr unsigned MO = 1000000007;
using Mint = ModInt<MO>;


int N, M, K;
vector<int> P;

int main() {
  for (int numCases; ~scanf("%d", &numCases); ) { for (int caseId = 1; caseId <= numCases; ++caseId) {
    scanf("%d%d%d", &N, &M, &K);
    P.assign(N, -1);
    for (int u = 1; u < N; ++u) {
      scanf("%d", &P[u]);
      --P[u];
    }
    
cerr<<"N = "<<N<<", M = "<<M<<", K = "<<K<<endl;
    Mint ans = 1;
    for (int u = N; u < N + M; ++u) {
      ans *= (2 * u - 1);
    }
    printf("%u\n", ans.x);
  }
#ifndef LOCAL
  break;
#endif
  }
  return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3640kb

input:

1 15
4 2 9
1 2 3
4 4 1
1 1 1
4 3 10
1 2 3
4 2 10
1 2 3
2 3 0
1
2 2 8
1
2 4 10
1
3 3 0
1 2
3 2 0
1 1
2 2 0
1
2 4 9
1
4 2 0
1 1 1
2 4 1
1
4 4 8
1 1 1
3 3 0
1 2

output:

1038345

result:

wrong answer 1st numbers differ - expected: '66', found: '1038345'

Test #2:

score: 0
Wrong Answer
time: 1ms
memory: 3592kb

input:

2 15
4 2 0
1 1 1
3 4 8
1 2
2 2 9
1
3 4 0
1 1
4 2 9
1 1 1
3 4 2
1 1
3 3 10
1 1
3 3 0
1 2
3 2 0
1 1
3 2 0
1 1
3 4 2
1 2
2 2 0
1
2 2 0
1
4 4 8
1 1 2
3 2 0
1 2

output:

1038345
1

result:

wrong answer 1st numbers differ - expected: '63', found: '1038345'

Test #3:

score: 0
Wrong Answer
time: 1ms
memory: 3836kb

input:

3 15
25363 0 10
1 2 2 4 5 6 5 7 5 7 7 8 13 11 13 12 17 14 19 20 20 22 23 24 22 26 26 24 28 28 30 32 32 30 34 33 35 34 38 37 41 41 40 40 42 46 45 44 47 49 51 49 51 54 54 56 55 58 57 59 60 62 60 61 64 65 63 65 68 66 70 68 69 74 75 72 76 77 78 77 77 78 79 84 83 83 85 87 89 90 91 90 90 91 93 93 97 95 98...

output:

741837626
911096465
606929763

result:

wrong answer 1st numbers differ - expected: '1', found: '741837626'

Test #4:

score: 0
Wrong Answer
time: 0ms
memory: 3616kb

input:

4 15
95 1 0
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
81 1 0
1 1 3 3 2 4 4 4 7 8 8 11 11 12 15 16 17 18 19 17 19 22 20 22 24 25 27 24 25 26 28 29 32 33 32...

output:

186703712
1
1
1

result:

wrong answer 1st numbers differ - expected: '189', found: '186703712'

Test #5:

score: 0
Wrong Answer
time: 1ms
memory: 3732kb

input:

5 15
24238 1 9
1 2 2 3 2 3 7 6 6 8 11 8 13 14 14 13 14 15 15 20 17 21 19 24 25 22 23 28 27 29 28 31 32 34 35 32 35 35 39 37 38 42 39 41 43 42 47 47 45 48 49 52 50 52 51 55 53 57 58 58 60 58 60 64 62 66 66 65 65 69 68 68 73 71 72 73 75 78 77 76 78 82 81 84 82 85 84 87 86 89 90 90 90 90 91 93 94 94 98...

output:

788470027
557238496
898920022
102686269
893491655

result:

wrong answer 1st numbers differ - expected: '48475', found: '788470027'

Test #6:

score: 0
Wrong Answer
time: 1ms
memory: 3592kb

input:

6 15
90 2 0
1 1 3 3 4 6 3 5 6 1 4 8 6 3 7 2 8 17 12 1 15 8 10 17 4 7 22 1 16 15 13 17 6 24 18 20 29 24 5 37 26 19 1 36 10 11 1 32 12 29 25 36 43 25 36 35 27 30 48 13 57 43 3 48 20 49 10 42 33 32 15 67 3 72 18 59 45 65 22 47 21 76 44 36 70 31 40 36 75
97 2 10
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

536624378
11486475
23
964491413
618242484
416309905

result:

wrong answer 1st numbers differ - expected: '32399', found: '536624378'

Test #7:

score: 0
Wrong Answer
time: 2ms
memory: 3596kb

input:

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

output:

235612782
534684485
995766505
347186165
465604123
481252169
66344980

result:

wrong answer 1st numbers differ - expected: '291919861', found: '235612782'

Test #8:

score: 0
Wrong Answer
time: 2ms
memory: 3844kb

input:

8 15
1 89 0

1 88 0

1 86 0

1 81 0

1 89 0

1 88 0

1 85 0

1 88 0

1 99 0

1 93 0

1 94 0

1 79 0

1 97 0

1 88 0

1 96 0


output:

29
1
1
1
1
1
1
1

result:

wrong answer 1st numbers differ - expected: '643555007', found: '29'

Test #9:

score: 0
Wrong Answer
time: 2ms
memory: 3660kb

input:

9 15
1 85 0

1 86 0

1 90 0

1 87 0

1 87 0

1 91 0

1 81 0

1 79 0

1 86 0

1 80 0

1 81 0

1 88 0

1 98 0

1 89 0

1 78 0


output:

29
1
1
1
1
1
1
1
1

result:

wrong answer 1st numbers differ - expected: '414090976', found: '29'

Test #10:

score: 0
Wrong Answer
time: 2ms
memory: 3716kb

input:

10 15
1 2600 0

1 2562 0

1 2885 0

1 2926 0

1 2980 0

1 2796 0

1 2809 0

1 2441 0

1 2964 0

1 2384 0

1 2634 0

1 2284 0

1 2732 0

1 2525 0

1 2635 0


output:

29
1
1
1
1
1
1
1
1
1

result:

wrong answer 1st numbers differ - expected: '980378455', found: '29'

Test #11:

score: 0
Wrong Answer
time: 1ms
memory: 3664kb

input:

11 15
1 97 8

1 98 8

1 75 9

1 86 10

1 91 10

1 80 10

1 99 10

1 75 10

1 81 3

1 86 8

1 76 10

1 79 9

1 77 9

1 79 8

1 92 10


output:

29
836517659
836517659
836517659
836517659
836517659
836517659
836517659
836517659
836517659
836517659

result:

wrong answer 1st numbers differ - expected: '201967493', found: '29'

Test #12:

score: 0
Wrong Answer
time: 3ms
memory: 3608kb

input:

12 15
1 2419 9

1 3000 8

1 2952 9

1 2911 10

1 2596 8

1 2997 10

1 2479 10

1 2447 10

1 2504 8

1 2325 9

1 2473 10

1 2674 8

1 2817 9

1 2303 8

1 2253 6


output:

29
805382819
805382819
805382819
805382819
805382819
805382819
805382819
805382819
805382819
805382819
805382819

result:

wrong answer 1st numbers differ - expected: '897921773', found: '29'

Test #13:

score: 0
Wrong Answer
time: 2ms
memory: 3740kb

input:

13 15
96 77 0
1 1 2 2 3 3 4 4 5 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 8 8 65 17 9 33 83 76 52 42 17 56 39 82 26 53
89 96 0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 ...

output:

888112648
1
1
15
15
15
315
315
9009
9009
328185
14549535
334639305

result:

wrong answer 1st numbers differ - expected: '875522633', found: '888112648'

Test #14:

score: 0
Wrong Answer
time: 2ms
memory: 3728kb

input:

14 15
79 92 0
1 2 1 3 2 5 6 6 6 10 7 8 10 13 14 13 15 16 17 18 17 18 21 24 25 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 18 33 33 18 9 48 19 2 6 12 28 3 22 50 5 24 14 10 15 42 11 44 36 38 58 21 9
96 81 0
1 2 3 4 3 2 4 7 7 1 7 10 12 13 1 9 14 6 13 18 4 2 4 14 25 3 3...

output:

531604407
772282313
77657487
77657487
703977374
43648605
801025413
218243025
171645988
476510664
960635399
562980957
35680467
324514012

result:

wrong answer 1st numbers differ - expected: '69626057', found: '531604407'

Test #15:

score: 0
Wrong Answer
time: 2ms
memory: 3648kb

input:

15 15
27219 2720 0
1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50...

output:

481042557
534684485
995766505
347186165
465604123
481252169
66344980
1
1
1
1
1
1
1
1

result:

wrong answer 1st numbers differ - expected: '512213075', found: '481042557'

Test #16:

score: 0
Wrong Answer
time: 0ms
memory: 3884kb

input:

16 15
23470 2270 0
1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50...

output:

825141071
534684485
995766505
347186165
465604123
481252169
66344980
1
1
1
1
1
1
1
1
1

result:

wrong answer 1st numbers differ - expected: '613353516', found: '825141071'

Test #17:

score: 0
Wrong Answer
time: 2ms
memory: 3876kb

input:

17 15
94 82 9
1 2 2 3 3 6 6 8 6 10 7 10 13 10 14 14 16 17 18 17 20 18 23 24 22 26 25 27 25 26 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 59 39 56 52 21 51 66 59 33 68 29 34 62 47 59 76 54 72 40 40 3 4 63 33 44 73 59 18 19 70 25 77
93 86 8
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

222058544
310832716
86046117
315
315
529505484
1
1
1
1
1
1
1
1
1
1
1

result:

wrong answer 1st numbers differ - expected: '57879436', found: '222058544'

Test #18:

score: 0
Wrong Answer
time: 0ms
memory: 3612kb

input:

18 15
78 96 1
1 1 2 2 3 3 4 4 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 7 7 52 54 22 16 21 56 64 32 42 64 52 49 19
87 86 9
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

510981649
1
3
15
15
315
315
9009
135135
328185
14549535
362513324
1
1
1
1
1
1

result:

wrong answer 1st numbers differ - expected: '76805686', found: '510981649'

Test #19:

score: 0
Wrong Answer
time: 0ms
memory: 3668kb

input:

19 15
26104 2591 3
1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50...

output:

325380232
534684485
995766505
347186165
465604123
481252169
66344980
1
1
1
1
1
1
1
1
1
1
1
1

result:

wrong answer 1st numbers differ - expected: '352998989', found: '325380232'

Test #20:

score: 0
Wrong Answer
time: 0ms
memory: 3684kb

input:

20 15
22821 2558 8
1 1 1 3 2 4 2 5 5 5 7 7 13 4 15 12 1 17 15 6 10 10 13 20 20 1 16 14 9 9 28 24 14 28 2 28 35 20 30 37 1 9 21 35 42 23 41 11 15 29 10 1 13 6 24 11 11 46 32 39 32 10 59 57 20 24 51 24 60 28 65 16 31 42 25 12 27 28 53 49 15 12 58 73 83 47 7 71 2 2 26 57 82 61 17 17 48 96 23 83 2 41 59...

output:

827147851
679874298
564349525
93178581
465683755
172995975
127163190
115198863
459951661
579386406
255900675
640118844
700899818
364193952
319312591
952690895
884554083
321628832
433561589
40685642

result:

wrong answer 1st numbers differ - expected: '852082753', found: '827147851'