QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#67152#5099. 朝圣道yehaodee0 891ms77840kbC++141.4kb2022-12-10 10:07:192022-12-10 10:07:20

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-12-10 10:07:20]
  • 评测
  • 测评结果:0
  • 用时:891ms
  • 内存:77840kb
  • [2022-12-10 10:07:19]
  • 提交

answer

#include <bits/stdc++.h>
#define N 200005
#define ll long long
#define DEBUG
#define pii pair<int, int>
#define mp make_pair
#define fi first
#define se second
using namespace std;
// TODO: your functions

namespace sub1 {
#define kN 3005
int inv2, inv4, P[kN][kN * 2], ans[kN];
int qpow(int a, int b, int mod) { int r = 1; while (b) { if (b & 1) r = 1ll * r * a % mod; a = 1ll * a * a % mod, b >>= 1; } return r; }
void preinit(int mod) {
  P[0][0 + kN] = 1; inv2 = qpow(2, mod - 2, mod), inv4 = qpow(4, mod - 2, mod);
  for (int k = 1; k <= 3000; k++) {
    for (int i = -3000; i <= 3000; i++) {
      P[k][i + kN] = 1ll * (1ll * P[k - 1][i - 1 + kN] * inv4 % mod + 1ll * P[k - 1][i + kN] * inv2 % mod + 1ll * P[k - 1][i + 1 + kN] * inv4 % mod) % mod;
    }
    for (int i = -3000; i <= 3000; i++) {
      ans[k] = (ans[k] + 1ll * abs(i) * P[k][i + kN] % mod) % mod;
    }
  }
}
} // sub1

void init(int o, int p) { // o is subtask id, p is mod
	// TODO: your init
  sub1::preinit(p);
}

int ask(long long n) {
	// TODO: your ask
  if (n <= 3000) { return sub1::ans[n]; }
	return 1;
}

// #define TEST
#ifdef TEST
ll o, T, p, n[N];
int main() {
#ifndef ONLINE_JUDGE
	freopen("test.in", "r", stdin); freopen("test.out", "w", stdout);
#endif
  scanf("%lld%lld%lld", &o, &T, &p);
  init(o, p);
  for (int i = 1; i <= T; i++) { scanf("%lld", &n[i]); printf("%lld\n", ask(n[i])); }
  return 0;
}
#endif

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 4
Accepted
time: 891ms
memory: 77832kb

input:

1 910276 554767
6
10
7
4
10
12
9
3
3
5
7
10
5
6
1
6
3
9
6
8
12
11
8
2
12
5
9
3
8
2
12
11
2
3
4
9
2
5
5
11
6
4
8
11
3
9
2
2
8
9
2
8
9
6
2
9
2
10
10
7
5
6
4
4
11
12
8
8
2
2
4
3
3
5
6
6
8
11
6
9
9
3
4
1
2
2
6
9
9
2
3
2
12
6
1
7
2
4
12
11
4
7
6
3
9
4
6
5
3
3
12
6
2
1
1
7
2
6
5
9
11
6
3
4
11
1
2
4
5
4
10...

output:

5419
364275
514407
329394
364275
229662
53120
520095
520095
509260
514407
364275
509260
5419
277384
5419
520095
53120
5419
115262
229662
243797
115262
416076
229662
509260
53120
520095
115262
416076
229662
243797
416076
520095
329394
53120
416076
509260
509260
243797
5419
329394
115262
243797
520095...

result:

ok 910276 numbers

Test #2:

score: -4
Wrong Answer
time: 878ms
memory: 77840kb

input:

1 972231 293475
7
1
9
6
5
1
11
5
5
12
2
2
7
3
4
10
10
3
2
10
7
1
10
9
1
3
5
6
7
2
7
4
1
10
1
9
3
10
10
2
6
11
4
10
12
8
5
2
12
4
9
12
7
2
12
4
3
1
2
9
12
1
4
5
6
12
6
5
9
2
5
12
3
4
6
12
12
2
1
6
4
12
10
5
12
7
9
8
3
8
10
5
3
6
12
7
7
10
7
10
8
7
7
2
2
4
8
6
10
8
11
6
11
10
3
9
5
2
5
1
10
2
11
4
4
3...

output:

53907
72353
136965
107406
56985
72353
74493
56985
56985
292701
21936
21936
53907
104988
52300
244885
244885
104988
21936
244885
53907
72353
244885
136965
72353
104988
56985
107406
53907
21936
53907
52300
72353
244885
72353
136965
104988
244885
244885
21936
107406
74493
52300
244885
292701
158286
569...

result:

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

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Wrong Answer

Test #5:

score: 0
Wrong Answer
time: 827ms
memory: 73744kb

input:

3 1 334547
8234

output:

1

result:

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

Subtask #4:

score: 0
Skipped

Dependency #3:

0%

Subtask #5:

score: 0
Skipped

Dependency #4:

0%

Subtask #6:

score: 0
Wrong Answer

Test #8:

score: 0
Wrong Answer
time: 875ms
memory: 77696kb

input:

6 958477 522361
280121915553826833
734266539148641647
72849162479700582
274266741463686096
60278972064195458
828423669427600612
571432949203039978
518511460268700898
486268614705621285
19216283231217074
611458416727512530
175147354285288662
799769622289998997
400123443628688299
145546980862133838
40...

output:

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
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
...

result:

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

Subtask #7:

score: 0
Skipped

Dependency #3:

0%

Subtask #8:

score: 0
Wrong Answer

Test #33:

score: 0
Wrong Answer
time: 831ms
memory: 73940kb

input:

8 9963 251
831797004675585320
494759973681332858
701341496127272302
252910460485222469
250965009655458584
366193481309061299
633134388675839346
791999098066205672
196620805863610860
363773642045280947
466508590762410710
407790578717064135
181590911404670570
570642047249889864
70138464625729452
23634...

output:

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
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
...

result:

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

Subtask #9:

score: 0
Skipped

Dependency #2:

0%