QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#535869 | #8904. Рекорды и антирекорды | Mispertion# | 0 | 8ms | 5716kb | C++23 | 2.3kb | 2024-08-28 15:58:05 | 2024-08-28 15:58:05 |
Judging History
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 = 2000 + 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];
void solve(){
cin >> n;
n++;
for(int i = 2; i <= n; i++){
cin >> a[i];
}
a[0] = infi;
a[1] = -infi;
for(int j = 0; j <= n; j++)
for(int k = 0; k <= n; k++)
dp[j][k] = -infi;
dp[1][0] = 0;
int ans = 0;
for(int as = 0; as <= n; as++){
for(int de = 0; de <= n; de++){
if(as == de) continue;
int i = max(as, de) + 1;
while(i <= n && a[i] < a[as])
i++;
if(i <= n)
dp[i][de] = max(dp[i][de], dp[as][de] + 1);
i = max(as, de) + 1;
while(i <= n && a[i] > a[de])
i++;
if(i <= n){
dp[as][i] = max(dp[as][i], dp[as][de] + 1);
}
}
}
for(int i = 0; i <= n; i++){
for(int j = 0; j <= n; j++){
ans = max(ans, dp[i][j]);
}
}
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: 0ms
memory: 5716kb
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 4 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 3 4 4 5 5 4 4 5 5 5 4 5 3 5 5 5 4 5 4 5 5 4 4 5 5 5 4 5 5 5 5
result:
wrong answer 90th 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: 8ms
memory: 3804kb
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 5 12 9 11 14 14 9 7 12 15 6 13 8 9 8 11 10 5 7 9 11 8 8 6 14 6 6 10 6 9 8 13 6 14 13 5 6 5 9 9 6 12 14 8 4 10 12 8 9 9 11 9 13 4 6 5 11 11 11 6 5 14 4 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 5 8 7 9 7 13 6 12 5 7 9 10 8 13 6 7 8 13 12 10 5 9 10 7 9 6...
result:
wrong answer 3rd numbers differ - expected: '13', found: '5'
Subtask #6:
score: 0
Skipped
Dependency #1:
0%