QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#535764#8904. Рекорды и антирекордыDimash#0 10ms3644kbC++231.2kb2024-08-28 14:27:012024-08-28 14:27:01

Judging History

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

  • [2024-08-28 14:27:01]
  • 评测
  • 测评结果:0
  • 用时:10ms
  • 内存:3644kb
  • [2024-08-28 14:27:01]
  • 提交

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;++j) {
            dp[i][j] = 1;
        }
    }
    for(int i = n  - 1; i >= 1; i--) {    
        for(int j = 1; j <= n; 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(j == 2 && i == 3 && k == 5) {
                //     cout << dp[k][val] + add + 1  << "x\n";
                // }
                if(a[k] < val) {
                    val = a[k];
                    add++;
                }
            }
            // cout << dp[i][j] << ' ';
        }
        // cout << '\n';
    }
    int v = n,res = 0,add = 0;
    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: 3616kb

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
4
4
4
5
4
5
4
4
4
3
5
4
4
3
3
4
4
3
3
4
4
4
4
4
4
4
5
3
4
4
4
3
4
3
5
4
3
5
5
4
4
4
4
4
3
4
4
4
3
5
5
4
4
4
3
3
4
4
4
5
4
4
5
4
3
3
4
4
5
5
4
3
4
4
4
4
4
3
4
4
4
4
3
3
3
5
3
3
4
4
4
4
4
3
4
3
3
5
4
5
4
5
5
4
4
5
3
5
5
4
4
4
4
3
4
4
4
4
4

result:

wrong answer 2nd numbers differ - expected: '5', found: '4'

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: 10ms
memory: 3644kb

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
11
13
12
9
11
14
14
9
7
12
15
6
13
8
9
8
11
9
5
7
9
11
12
8
6
14
6
6
10
5
9
8
13
5
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
4
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
9
8
6
10
11
10
15
12
11
12
7
8
7
9
7
13
6
12
5
6
9
10
8
13
6
7
7
13
12
9
5
9
10
7
11...

result:

wrong answer 2nd numbers differ - expected: '12', found: '11'

Subtask #6:

score: 0
Skipped

Dependency #1:

0%