QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#535775#8904. Рекорды и антирекордыDimash#0 11ms3728kbC++231.1kb2024-08-28 14:36:242024-08-28 14:36:25

Judging History

This is the latest submission verdict.

  • [2024-08-28 14:36:25]
  • Judged
  • Verdict: 0
  • Time: 11ms
  • Memory: 3728kb
  • [2024-08-28 14:36:24]
  • Submitted

answer

#include <bits/stdc++.h>

using namespace std;
    
typedef long long ll;
const int  N = 200 + 12, MOD = 998244353;

int n,a[N],dp[N][N];
void test() {
    cin >> n;
    for(int i = 1; i <= n;i++) {
        cin >> a[i];
        for(int j  = 1;j <= n + 1;++j) {
            dp[i][j] = 1;
        }
    }
    for(int i = n  - 1; i >= 1; i--) {    
        for(int j = 1; j <= n + 1; j++) {
            int add =0 ,val = j;
            for(int k = i + 1; k <= n; k++) {
                if(a[k] > a[i]) dp[i][j] = max(dp[i][j],dp[k][val] + add + 1);
                if(a[k] < val) {
                    val = a[k];
                    add++;
                }
                dp[i][j] = max(dp[i][j],1 + add);   
            }
        }
    }
    int v = n + 1,res = 0,add = 0;
    // cout << dp[3][n + 1] << '\n';
    for(int i = 1;i <= n;i++) {
        res = max(res,dp[i][v] + add);
        if(v > a[i]) {
            v = a[i];
            add++;
        }
    }
    cout << res << '\n';
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t = 1; 
    cin >> t;
    while(t--) {
        test();
    }
}

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

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

input:

120
5
3 1 4 2 5
5
3 4 2 5 1
5
5 4 2 1 3
5
1 2 5 4 3
5
2 4 3 1 5
5
3 1 5 2 4
5
1 4 2 3 5
5
5 1 4 3 2
5
1 5 3 2 4
5
3 1 2 5 4
5
3 1 5 4 2
5
1 2 3 4 5
5
1 5 2 4 3
5
3 5 2 1 4
5
2 1 5 4 3
5
1 5 3 4 2
5
3 1 4 5 2
5
2 1 4 5 3
5
1 3 5 4 2
5
5 3 4 2 1
5
2 1 3 5 4
5
2 3 1 5 4
5
2 4 3 5 1
5
4 3 2 5 1
5
4 5 2 ...

output:

5
5
5
5
5
4
5
5
5
4
4
5
5
5
3
5
5
4
5
5
4
4
5
5
4
5
4
5
4
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
4
5
5
4
5
5
5
4
5
5
5
5
4
5
5
5
5
5
5
4
5
5
5
5
5
5
4
5
4
5
5
5
5
4
5
5
4
5
4
5
4
5
5
4
4
4
4
5
5
4
4
5
5
5
4
5
4
5
5
5
4
5
4
5
5
4
4
5
5
5
4
5
5
5
5

result:

wrong answer 15th numbers differ - expected: '4', found: '3'

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #1:

0%

Subtask #4:

score: 0
Skipped

Dependency #1:

0%

Subtask #5:

score: 0
Wrong Answer

Test #49:

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

input:

9000
8
4 1 2 3 5 6 7 8
12
1 2 12 3 4 5 6 7 8 9 10 11
15
4 1 13 2 15 3 5 6 7 8 9 10 11 12 14
15
4 5 10 14 1 2 3 6 7 8 9 11 12 13 15
9
4 1 2 3 5 6 7 8 9
13
1 4 9 12 2 3 5 6 7 8 10 11 13
14
1 10 2 3 4 5 6 7 8 9 11 12 13 14
15
1 6 7 2 3 4 5 8 9 10 11 12 13 14 15
12
1 4 6 10 12 2 3 5 7 8 9 11
8
7 8 1 2 3...

output:

8
12
13
12
9
11
14
14
9
7
12
15
6
13
8
9
8
11
10
5
7
9
11
12
8
6
14
6
6
10
6
9
8
13
6
14
13
5
6
5
9
13
6
12
14
8
4
12
12
8
9
9
11
9
13
6
6
5
11
11
11
6
5
14
13
14
12
6
14
8
8
9
7
9
15
10
7
14
8
11
5
6
8
12
9
8
12
8
9
10
8
6
10
11
10
15
12
11
12
7
8
7
9
7
13
6
12
5
7
9
10
8
13
6
7
8
13
12
10
5
9
10
7...

result:

wrong answer 48th numbers differ - expected: '13', found: '12'

Subtask #6:

score: 0
Skipped

Dependency #1:

0%