| Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|---|
| 38349 | Gapple | 【S】T1 | C++ | 通过 | 100 | 41 MS | 264 KB | 488 | 2025-10-03 14:38:33 |
#include <algorithm> #include <iostream> using namespace std; using i64 = long long; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int n; cin >> n; int f[6] = { 0, 0, 0, 0, 0, 0 }; for (int i = 1; i <= n; ++i) { int a; cin >> a; for (int j = 2; j < 6; ++j) f[j] = max(f[j - 1], f[j] + (j % 2 + 1 == a)); } cout << f[5] << '\n'; return 0; }