| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 38349 | Gapple | 【S】T1 | C++ | Accepted | 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; }