QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#734446#9615. 骨牌覆盖YuJiahe0 0ms3628kbC++23552b2024-11-11 10:41:282024-11-11 10:41:29

Judging History

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

  • [2024-11-11 10:41:29]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:3628kb
  • [2024-11-11 10:41:28]
  • 提交

answer

#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <queue>
using namespace std;
typedef long long ll;
const int N = 500005;
int t, n, a[N], b[N << 1];ll ans;
int main(){scanf("%d", &t);
	while (t --){scanf("%d", &n), ans = 0;
		for (int i = -n;i <= n;i ++) b[i + n] = 0;b[n] = 1;
		for (int i = 1;i <= n;i ++) scanf("%d", &a[i]);
		for (int i = 1;i <= n;i ++) a[i] = a[i] & 1 ? i & 1 ? 1 : -1 : 0;
		for (int i = 1, sm = n;i <= n;i ++) sm += a[i], ans += b[sm], b[sm] ++;
		printf("%lld\n", ans);
	}
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

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

input:

100
10
6 6 5 7 5 4 5 6 10 2
10
3 0 5 4 6 6 6 3 1 10
10
5 3 3 4 7 7 7 5 4 1
10
9 5 6 4 5 5 9 0 3 0
10
5 8 8 5 7 7 1 6 4 2
10
5 8 4 5 1 7 2 5 5 1
10
5 8 6 5 7 5 5 0 10 2
10
4 6 1 10 1 9 3 1 7 4
10
5 3 10 5 5 9 0 2 9 7
10
5 8 9 9 4 8 4 5 9 3
10
5 5 1 1 4 9 9 8 5 4
10
5 8 9 9 8 5 9 5 5 6
10
6 6 6 7 6 9 ...

output:

15
24
19
17
31
17
31
15
20
24
21
24
17
16
18
24
24
31
27
16
21
25
17
18
13
23
17
31
24
12
23
27
29
27
25
13
15
23
23
21
25
25
31
16
24
27
31
27
24
15
23
15
27
24
17
13
16
22
29
16
12
16
14
14
29
24
19
29
17
16
31
22
20
23
13
15
25
21
23
27
21
13
24
29
19
20
15
19
21
25
21
20
29
14
14
21
27
10
17
27

result:

wrong answer 9th lines differ - expected: '16', found: '20'

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #2:

0%

Subtask #4:

score: 0
Skipped

Dependency #3:

0%

Subtask #5:

score: 0
Skipped

Dependency #4:

0%