#P10885. 【MX-S3-T1】「FeOI Round 1」野心
【MX-S3-T1】「FeOI Round 1」野心
Background
Original link: https://oier.team/problems/S3A。
Problem Description
Given a permutation of , ask how many indices () satisfy that after sorting, both and are arithmetic progressions.
Input Format
This problem contains multiple test cases in a single test file.
The first line contains an integer , the number of test cases.
Then for each test case, the format is:
The first line contains an integer , the length of the permutation.
The next line contains integers, the permutation .
Output Format
For each test case, output one line containing one integer, the answer to the query.
2
4
1 3 2 4
5
1 5 3 2 4
3
3
4
6
2 1 4 3 6 5
6
1 2 3 4 5 6
3
1 3 2
1
1
2
5
2
0
6
2
1 2
20
16 2 10 18 4 6 8 20 14 12 3 9 17 13 1 15 7 11 19 5
9
3 4 1 5 2 6 7 8 9
10
1 3 2 4 7 6 5 8 10 9
13
5 7 3 11 1 9 13 6 10 4 2 8 12
5
1 2 3 4 5
1
1
4
5
1
4
Hint
[Sample Explanation #1]
Test case 1: There are three splits: , , .
Test case 2: There are three splits: , , .
[Sample Explanation #2]
Test case 1: There are two splits: , .
Test case 2: Every split is valid.
Test case 3: Every split is valid.
Test case 4: There is no split, so no split is valid.
[Constraints]
This problem uses bundled tests.
Let be the sum of all within a single test file.
For of the data, , , . It is guaranteed that is a permutation and .
| Subtask ID | Score | ||
|---|---|---|---|
Please use fast input/output.
A new subtask 4 is added as hack testdata, with a score of .
Translated by ChatGPT 5