QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#535812#8904. Рекорды и антирекордыMispertion#0 17ms6032kbC++232.5kb2024-08-28 15:10:412024-08-28 15:10:41

Judging History

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

  • [2024-08-28 15:10:41]
  • 评测
  • 测评结果:0
  • 用时:17ms
  • 内存:6032kb
  • [2024-08-28 15:10:41]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;
#pragma GCC optimize("Ofast")

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef long long ll;
#define int ll
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define pb push_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define mispertion ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define F first
#define S second
#define getlast(s) (*s.rbegin())
#define debg cout << "OK\n"

const ld PI = 3.1415926535;
const int N = 200 + 10;
const int M = 1e5 + 10;
int mod = 998244353;
const int infi = INT_MAX;
const ll infl = 1e16;
const int P = 2;

int mult(int a, int b){
    return a * 1LL * b % mod;
}

int sum(int a, int b){
    if(a + b >= mod)
        return a + b - mod;
    if(a + b < 0)
        return a + b + mod;
    return a + b;
}

int binpow(int a, int n){
    if (n == 0)
        return 1;
    if (n % 2 == 1){
        return mult(binpow(a, n - 1), a);
    }
    else{
        auto b = binpow(a, n / 2);
        return mult(b, b);
    }
}

int n, a[N], dp[N][N][N];

void solve(){
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
    }
    dp[0][1][1] = 1;
    dp[1][0][1] = 1;
    int ans = 0;
    for(int i = 1; i < n; i++){
        for(int as = 0; as <= i; as++){
            for(int de = 0; de <= i; de++){
                if(as == de) continue;
                //i + 1 >> as
                int nxt = as, ad = 0;
                if(as == 0 || a[i + 1] > a[as])
                    nxt = i + 1, ad = 1;
                dp[i + 1][nxt][de] = max(dp[i + 1][nxt][de], dp[i][as][de] + ad);
                //i + 1 >> de
                nxt = de, ad = 0;
                if(de == 0 || a[i + 1] < a[de])
                    nxt = i + 1, ad = 1;
                dp[i + 1][as][nxt] = max(dp[i + 1][as][nxt], dp[i][as][de] + ad);
            }
        }
    }
    for(int i = 0; i <= n; i++)
        for(int j = 0; j <= n; j++)
            ans = max(ans, dp[n][i][j]);
    for(int i = 0; i <= n; i++)
        for(int j = 0; j <= n; j++)
            for(int k = 0; k <= n; k++)
                dp[i][j][j] = 0;
    cout << ans << '\n';
}

signed main(){
    mispertion;
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    int t = 1;
    cin >> t;
    while (t--){
        solve();
    }
    return 0;
}

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3620kb

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

result:

wrong answer 6th numbers differ - expected: '4', found: '5'

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: 17ms
memory: 6032kb

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

result:

wrong answer 3rd numbers differ - expected: '13', found: '15'

Subtask #6:

score: 0
Skipped

Dependency #1:

0%